That worked great. I am now having problem with 2 other functions though.
I tried changing integer to short but I am still having the same problem.
These were the functions in VB6. I also changed any to object.
Public Declare Function MBTReadRegisters Lib "MBT" (ByVal hSocket As Long,
ByVal tableType As Byte, ByVal dataStartAddress As Integer, ByVal numWords
As Integer, pReadBuffer As Any, ByVal fpReadCompletedCallback As Long, ByVal
callbackContext As Long) As Long
Public Declare Function MBTWriteRegisters Lib "MBT" (ByVal hSocket As Long,
ByVal dataStartAddress As Integer, ByVal numWords As Integer, pWriteBuffer
As Any, ByVal fpWriteCompletedCallback As Long, ByVal callbackContext As
Long) As Long
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
In article <#R**************@TK2MSFTNGP10.phx.gbl>, Altman wrote: I am having problems with Declaring a function from a dll. I had it work
in
VB 6 but I can't get it to work in VB.net. This was the call in VB6
Public Declare Function MBTConnect Lib "MBT" (ByVal szHostAddress As
String,
ByVal port As Integer, ByVal useTCPorUDP As Long, ByVal requestTimeout As
Long, hSocket As Long) As Long
Public Declare Function MBTConnect Lib "MBT" _
(ByVal szHostAddress As String, _
ByVal port As Short, _
ByVal useTCPorUDP As Boolean, _
ByVal requestTimeout As Integer, _
ByRef hSocket As Integer) As Integer
Data type sizes have changed in VB.NET.
--
Tom Shelton [MVP]