Calling a DLL subroutine

G

Guest

I have a DLL subroutine that I'd like to call from within a class I've
created. I've declared the DLL at the top of my class:

Private Declare Sub latlonlatlon_bd Lib _
"hipcalc.dll" _
(ByVal modelnumber As Long, ByVal txLat As Double, ByVal txLon As
Double, _
ByVal rxlat As Double, ByVal rxlon As Double, ByRef dist As Double, _
ByRef bearingTrans As Double, ByRef bearingReceiver As Double)

I call the subroutine:

Call latlonlatlon_bd(34, phi1, lambda1, phi2, lambda2, d, bear12, bear21)
where: phi1,lamda1, phi2, and lamda2 are passed as input
d, bear12, and bear21 are passed as output

I get the following error when it tries to execute call to the DLL:

An unhandled exception of type 'System.NullReferenceException' occurred in
PointBearingDistance.exe

Additional information: Object reference not set to an instance of an object.

I don't know what I'm doing wrong. I know it works in VB 6.

Any help would be gretly appreciated.

Thanks.

Marianne
 
M

Mattias Sjögren

Marianne,
I don't know what I'm doing wrong. I know it works in VB 6.

If _the same_ Declare statement works in VB6, you should change the
first parameter type to Integer when moving it to VB.NET.



Mattias
 
G

Guest

Mattias Sjögren said:
Marianne,


If _the same_ Declare statement works in VB6, you should change the
first parameter type to Integer when moving it to VB.NET.



Mattias

Thanks. That works!

Marianne
 

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