how to pass a structure from a DLL to vb.net application

S

Support

Hello:
I have a VB.NET DLL with a public structure:
Public Class OCIDIIRRegistry

Public Structure OCIDIIRRegistryReturn
Public OCIDIIRimpliciterror As String
Public OCIDIIRexpliciterror As String
Public OCIDIIRvalueRequested
End Structure


the DLL has a Function

Public Function SetRegistry_String(ByVal Registryname As String, ByVal
registryvalue As String) As OCIDIIRRegistryReturn
OCIDIIRimpliciterror = OCIDIIRErrors.BeginErrorNOTOK
OCIDIIRexpliciterror = "Error in SetRegistry_String: " + Registryname +
" [" + OCIDIIRexpliciterror + "]"
End Function

'===========================================================================
=============

In VB.NEt, I want to get the values OCIDIIRimpliciterror and
OCIDIIRexpliciterror from SetRegistry_String

I tried in the VB.NET app:


Public Structure MyOCIDIIRRegistryReturn
Public MyOCIDIIRimpliciterror As String
Public MyOCIDIIRexpliciterror As String
Public MyOCIDIIRvalueRequested
End Structure


Dim MyRegistrySetting As New OCIDIIRRegistry.GAINSCOM.OCIDIIRRegistry ' name
of the DLL
Dim MyRegistryStructure As MyOCIDIIRRegistryReturn
MyRegistryStructure = MyRegistrySetting.GetRegistry_String("server", "SQL")


' as an attempt to pass the structure but I get an squigly error :

Value of type 'OCIDIIRRegistry.GAINSCOM.OCIDIIRRegistry.OCIRegistryReturn'
cannot be converted to 'DIIRMAIN.frmMAIN.MyOCIDIIRRegistryReturn'

What does that mean ? and should I do about it ?

Thanks

TErry
 
S

Support

THANK YOU! after 6 hours of work on this + your two minutes, I can go home!
Take Care

David Williams said:
Drop the structure MyOCIDIIRRegistryReturn. Just use the
OCIDIIRRegistryReturn structure. The probelm is that they are different
structures so the two are not the same.
HTH
--
David Williams, VB.NET MVP


Support said:
Hello:
I have a VB.NET DLL with a public structure:
Public Class OCIDIIRRegistry

Public Structure OCIDIIRRegistryReturn
Public OCIDIIRimpliciterror As String
Public OCIDIIRexpliciterror As String
Public OCIDIIRvalueRequested
End Structure


the DLL has a Function

Public Function SetRegistry_String(ByVal Registryname As String, ByVal
registryvalue As String) As OCIDIIRRegistryReturn
OCIDIIRimpliciterror = OCIDIIRErrors.BeginErrorNOTOK
OCIDIIRexpliciterror = "Error in SetRegistry_String: " + Registryname +
" [" + OCIDIIRexpliciterror + "]"
End Function

'===========================================================================
=============

In VB.NEt, I want to get the values OCIDIIRimpliciterror and
OCIDIIRexpliciterror from SetRegistry_String

I tried in the VB.NET app:


Public Structure MyOCIDIIRRegistryReturn
Public MyOCIDIIRimpliciterror As String
Public MyOCIDIIRexpliciterror As String
Public MyOCIDIIRvalueRequested
End Structure


Dim MyRegistrySetting As New OCIDIIRRegistry.GAINSCOM.OCIDIIRRegistry ' name
of the DLL
Dim MyRegistryStructure As MyOCIDIIRRegistryReturn
MyRegistryStructure = MyRegistrySetting.GetRegistry_String("server", "SQL")


' as an attempt to pass the structure but I get an squigly error :

Value of type 'OCIDIIRRegistry.GAINSCOM.OCIDIIRRegistry.OCIRegistryReturn'
cannot be converted to 'DIIRMAIN.frmMAIN.MyOCIDIIRRegistryReturn'

What does that mean ? and should I do about it ?

Thanks

TErry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top