How to get an old DLL working in VB.NET

T

Tom Edelbrok

I have an old 32-bit DLL that is very necessary to our operation. It
extracts data from a proprietary inudstrial database and gives it back to
our VB6 programs. Everything works great under VB6.

But under VB.NET fetching data via this DLL doesn't work (actually parts of
it work - we can open and close a database session, but can't fetch any
data). When we make a call to fetch data we get the error "Object reference
not set to an instance of an object". The 'Declare' is overloaded as follows
(note that prior to converting to VB.NET there was a single 'Declare' that
used 'ByRef value as any'. The 'as any' is not valid in VB.NET and had to be
replaced).

Declare Function Get_FIELD_Data Lib "Accdb32.dll" Alias "acc_getFLDdata"
(ByVal SessionID As Integer, ByVal Table As Integer, ByVal IDX As Integer,
ByVal size As Integer, ByRef value As String, ByRef ret_size As Integer,
ByRef fld_Error As Integer) As Integer

Declare Function Get_FIELD_Data Lib "Accdb32.dll" Alias "acc_getFLDdata"
(ByVal SessionID As Integer, ByVal Table As Integer, ByVal IDX As Integer,
ByVal size As Integer, ByRef value As Integer, ByRef ret_size As Integer,
ByRef fld_Error As Integer) As Integer

Declare Function Get_FIELD_Data Lib "Accdb32.dll" Alias "acc_getFLDdata"
(ByVal SessionID As Integer, ByVal Table As Integer, ByVal IDX As Integer,
ByVal size As Integer, ByRef value As Short, ByRef ret_size As Integer,
ByRef fld_Error As Integer) As Integer



Can anyone suggest a way to tell VB.NET that this DLL is not VB.NET, and
that it should just run it as an old DLL from past history?



Thanks in advance,



Tom Edelbrok
 
T

Tom Edelbrok

I've solved the problem myself. I created an Active-X wrapper around the old
DLL using VB6. It turns out that VB.Net talks to the Active-X control just
fine, and the Active-X wrapper code in VB6 talks to the old DLL just fine.
Problem solved.

Tom
 

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