frmRegister.vb

PreviousNext

Ways to activate your objects from code.

(c) 2007-2008 Hermetech International Ltd.

If you will examine the code under the various buttons you will see several ways to activate your objects silently directly from your code.

 

A registration form

 

Next: frmVendors.vb

 

 

Private Sub btnActivate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnActivate.Click

 'In this sub we are showing a generic product activation. 

 'An internet connection is required.

 Try

     Dim oVendor As New EHL7_mc2005.HL7Vendor

     Dim sComment As String = "", sMessage As String = ""

     Dim oLicense As EHL7_mc2005.ProductLicense

     oLicense = oVendor.NewProductLicense()

     If MsgBox("Show the user interface with the option to activate a Developer's license?", _ 

              MsgBoxStyle.YesNo, "Show Which Method") = MsgBoxResult.No Then

         'By passing FALSE in (or omitting) the optional 4th parameter 

         'there will be no option for the user to activate

         'the computer with a developer's license

         If Not oLicense.ShowActivation1(, , , FalseThen

             If oLicense.IsError Then

                 MsgBox(oLicense.LastError, MsgBoxStyle.ApplicationModal, "Error")

             End If

             oLicense = Nothing

             Exit Sub

         End If

     Else

         'By passing TRUE in the optional 4th parameter there will be an option 

         'for the user to activate the computer with a developer's license

         If Not oLicense.ShowActivation1(, , , TrueThen

             If oLicense.IsError Then

                 MsgBox(oLicense.LastError, MsgBoxStyle.ApplicationModal, "Error")

             End If

             oLicense = Nothing

             Exit Sub

         End If

 

     End If

     oLicense = Nothing

     oVendor = Nothing

     LoadVendorInfo()

 Catch ex As Exception

     MouseOff()

     MsgBox(ex.ToString)

 End Try

End Sub