PDA

View Full Version : Using IC Image Control in VB.NET class



flacogordo
August 13, 2008, 16:08:18
Hi ,

I have the IC Imaging Control 3.06, also using VB2005 to create a User Control to show the Camera to personnel, when calling the InitializeComponent in the class I get the exception "IC ... not licensed to run on this PC", i searched to forums, i found a similar problem with a solution in C#, (I'm also new to .Net), is there some steps and code to follow in VB.net in the forum?, I convert some of the c# code but i don't know where to find the LicenseContext file to inherit the class.

Please Help...

Regards.

Sascha Schmidt
August 14, 2008, 12:28:52
Hallo,

The class "LicenseContext" belongs to the .Net framework -> "System.ComponentModel.LicenseContext".
In VB, the class inherited from LicenseContext should be look as follows:


Class MyLicenseContext
Inherits LicenseContext

Private m_LicenseKey As String

Public Sub New()
End Sub

Public Overrides ReadOnly Property UsageMode() As LicenseUsageMode
Get
Return LicenseUsageMode.Runtime
End Get
End Property

Private Function SetChar(ByVal Licensekey As System.String) As String
Dim NewChar As System.String = ""
Dim i As Integer
For i = 0 To Licensekey.Length - 1
NewChar = String.Concat(NewChar, ChrW(Asc(Licensekey(i)) Xor &HB3))
Next
Return NewChar
End Function

Public Overrides Function GetSavedLicenseKey(ByVal type As System.Type, ByVal resourceAssembly As System.Reflection.Assembly) As System.String
Return SetChar("bsssss") ' Insert your license key here!
End Function

Public Overrides Function GetService(ByVal type As System.Type) As Object
Return Nothing
End Function

Public Overrides Sub SetSavedLicenseKey(ByVal type As System.Type, ByVal key As String)
End Sub

End Class

flacogordo
August 14, 2008, 15:47:31
Sascha,

Thank you so much for your help, it its working now...

I'm scheduling a training for .NET... in the following weeks..

jejeje

Take Care.

Jorge

aaborkar
May 20, 2009, 04:13:49
Hi Sasha,
Can you pls give me the c# equivalent of the VB.net code below. I keep getting the error


'System.Linq.Strings' is inaccessible due to its protection level

as ChrW seems to be a VB thing. I am running into a similar problem of license error when using the IC Control in a user control. Please information what are the additional steps need to avoid this error.

Thanks




Hallo,

The class "LicenseContext" belongs to the .Net framework -> "System.ComponentModel.LicenseContext".
In VB, the class inherited from LicenseContext should be look as follows:


Class MyLicenseContext
Inherits LicenseContext

Private m_LicenseKey As String

Public Sub New()
End Sub

Public Overrides ReadOnly Property UsageMode() As LicenseUsageMode
Get
Return LicenseUsageMode.Runtime
End Get
End Property

Private Function SetChar(ByVal Licensekey As System.String) As String
Dim NewChar As System.String = ""
Dim i As Integer

Return NewChar
End Function

Public Overrides Function GetSavedLicenseKey(ByVal type As System.Type, ByVal resourceAssembly As System.Reflection.Assembly) As System.String
Return SetChar("bsssss") ' Insert your license key here!
End Function

Public Overrides Function GetService(ByVal type As System.Type) As Object
Return Nothing
End Function

Public Overrides Sub SetSavedLicenseKey(ByVal type As System.Type, ByVal key As String)
End Sub

End Class

Stefan Geissler
May 20, 2009, 10:30:51
Please contact me at http://www.imagingcontrol.com/en_US/support/case/ for this internal stuff.