I am using Visual C Dll in my vb.net application which pass parameters
from my application and return value. some times it returns data ok and
some time it does not return data or return incorrect values.i think
there is a memory problem so how can i handle memory in my vb.net
application so it display data correctly. the code for my application
is:
<DllImport("D:\Dot Net NCC\bin\MyDll.dll", CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function InitPack(ByVal msgtype As Integer, ByVal buffer() As Byte) As Byte
End Function
Public Shared Function pckPack(ByVal field() As Byte, ByVal Fieldname() As Byte, ByVal position As Integer) As Byte
End Function
//button click event
Dim m_buffer(1024) As Byte
InitPack(200, m_buffer) '2+8 = 10
Dim m_termdata(8) As Byte
m_termdata = stringcharToByteArray("TermID69")
Dim bitno41(2) As Byte
bitno41 = stringcharToByteArray("9")
pckPack(bitno41, m_termdata, 8)
---------------------------------------------------------------
Public Function stringcharToByteArray(ByVal str As String) As Byte()
Dim s As Char()
s = str.ToCharArray
Dim b(s.Length - 1) As Byte
Dim i As Integer
For i = 0 To s.Length - 1
b(i) = Convert.ToByte(s(i))
Next
Return b
End Function
please help how can i handle memory in my vb.net application so it display data correctly?