How to deactivate a license in VB.NET

The code below illustrates how to deactivate a license in VB.NET.

Private Sub ReleaseLicense()

    Dim lv As QLM.LicenseValidator

ย   ' settingsFile is the xml file generated by the Protect Your Application wizard
   lv = New QLM.LicenseValidator(settingsFile)

ย   Dim akey As String
   Dim ckey As String
   Dim compID As String
   Dim licenseBinding As ELicenseBinding

ย   akey = String.Empty
   ckey = String.Empty

   ' Update the license binding as needed
   licenseBinding = ELicenseBinding.ComputerName

ย   compID = lv.QlmLicenseObject.GetComputerID(licenseBinding)

ย   lv.QlmLicenseObject.ReadKeys(akey, ckey)

ย   If akey.Length > 0 Then
ย       Dim response As String
       response = String.Empty

ย       lv.QlmLicenseObject.ReleaseLicense("", akey, compID, response)

       Dim li As ILicenseInfo
       li = New LicenseInfo
       Dim message As String

       message = String.Empty

       If (lv.QlmLicenseObject.ParseResults(response, li, message) = True) Then
        End If
        MessageBox.Show("There is no license activated on this computer.")
   End If
End Sub

Last updated