473,473 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Memory error using Visual C Dll in VB.Net Program

31 New Member
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?
Jun 9 '07 #1
0 801

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Tmenke | last post by:
Hello, I was wondering if anyone can help. I wrote a program in VBA. It does some calculations with matrices (arrays) . These arrays are dynamic and are sized according to a user defined input....
7
by: fremenusul | last post by:
I know I have been asking LOTS of xml questions and I really apprecaite all the help. Here is my XML file <?xml version="1.0" encoding="utf-8" ?> <products> <!-- Repeat the structure below...
7
by: fremenusul | last post by:
I know I have been asking LOTS of xml questions and I really apprecaite all the help. Here is my XML file <?xml version="1.0" encoding="utf-8" ?> <products> <!-- Repeat the structure below...
4
by: pberent | last post by:
I am trying to run a c# program which loads very large arrays (total of about 1.2GB). I have 2GB of RAM on my machine and looking at task manager it doesnt look like it has all been used. I have...
3
by: vrsathyan | last post by:
Hi.., While executing the following code in purifier.., std::vector<int> vecX; vecX.clear(); int iCount = 0; { int iVal;
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.