Step 4.)

Now we need to create a way for the user to register the application. 

a) Open the form "frmAbout", and delete the Label "lblDescription". Add three TextBox controls, named "txtUsername", "txtCompany", and "txtRegcode". Delete the value in the property "text" for each of the controls, and add the appropriate static labels. 

b) Add a Command Button, named "cmdRegister", and change the text to display "Register" 

c) In the method Form_Load(), add the following code at the end:

    If bRegistrationIsValid Then 
        HideRegisterControls 
    End If

d) Add this procedure at the end of the module:

    Private Sub HideRegisterControls() 
        '// Hides the controls for registering. 
   
     Label2.Visible = False 
        Label3.Visible = False 
        Label4.Visible = False 
        txtCompany.Visible = False 
        txtUsername.Visible = False 
        txtRegcode.Visible = False 
        cmdRegister.Visible = False 
    End Sub

e) Add the following code to the click event of the Register button:

    Private Sub cmdRegister_Click() 
        cRedReg.UserName = txtUsername 
        cRedReg.CompanyName = txtCompany 
        cRedReg.RegCode = txtRegcode 
        cRedReg.Rights = "Your Rights"

        If (cRedReg.Registered()) Then 
            cRedReg.SaveRegistration ("Your Rights") 
            HideRegisterControls 
        End If 
    End Sub

f) You will have to replace all references to "Your Rights" with the Rights you assign your program, and use your developer registration in the call to InitRegistration.


    Back        Download Project Files