.net help
We are developing a web application in .NET.I need to use VB6 OCX control in asp.net.
I add reference to the OCX control in my .net application
In my vb coding (default.aspx.vb), i add the following code to create object for the OCX Control,
Imports IPM50_OCX
Dim WithEvents objGPRSControl As IPM50_OCX.GPRSControl
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
objGPRSControl.LocalPort = 1001 I got the error in this line “Object reference not set to an instance of an object.”
objGPRSControl.GPRSMode = 2
end sub
So I add ‘New’ keyword in OCX object creation step
Dim WithEvents objGPRSControl as new IPM50_OCX.GPRSControl
After I use the ‘New’ keyword, I got this error. I try to change the scope of the declaration, but it’s not resolve.
Error 99 'IPM50_OCX.GPRSControlClass.Private Sub New ()' is not accessible in this context because it is 'Private'.
I search the internet getting solution to this problem.after I follow these steps
Register the IPM50_OCX file in the global assembly cache (GAC).
gacutil /i E:\Ganga\Projects\IPM50-GPRS\Bin\Interop.IPM50_OCX.dll
After run this, I got
Failure adding assembly to the cache: Attempt to install an assembly without a strong name
I create Key for IPM50_OCX.
Sn.exe –k Interop.IPM50_OCX.keys
I gives the public key 1231ec482047e661
<Assembly: AssemblyKeyFileAttribute("C:\Program Files\Microsoft Visual Studio 8\VC\Interop.IPM50_OCX.dll")>
Error 99 Unable to emit assembly: Referenced assembly 'Interop.IPM50_OCX' does not have a strong name
Can anyone help me in this regard?