Example - Method SaveRegistration()

In the sample project Calc Demo 1, the registration process demonstrates the use of LoadRegistration and SaveRegistration. The Registration screen shown below has three fields that are User-Input screens. These fields are used to test for a valid registration code. If the registration code is valid, then the registration information is saved to the users registry.

This code is in frmRegister.frm:



Private Sub cmdRegister_Click()

Dim lRetVal As Long
    RedReg.UserName = UserName.Text
    RedReg.CompanyName = CompanyName.Text
    RedReg.Rights = CALC_RIGHTS
    RedReg.RegCode = RegCodeStr.Text
    lRetVal = RReg.Registered
    If lRetVal = True Then
        MsgBox "Thank you for registering."
        lRetVal = RedReg.SaveRegistration(CALC_RIGHTS)
        If Not lRetVal Then
            MsgBox "Error #" & RedReg.LastError & vbCrLf & _
                "Registration Information Not Saved. "
        End If
        bRegistered = True
    Else
        MsgBox "Registration failed.", vbCritical
    End If
    Unload Me
    SetupCalc
End Sub