473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

String Array Issue - VB 2005

Hi Friends,

Any help would be highly appreciated for the following problem :

I have a vb 6 application which makes call to an API in some dll
which returns an array of strings and no of elements in that array :

Declare Function vb_inq_applications Lib "tcvbodss.dll" (ByVal
login_handle As Integer, ByRef no_of_elements As Integer, ByRef
str_array() As String, ByRef handle As Integer) As

Integer

Dim handle As Integer
Dim no_of_elements As Integer
Dim str_array(16) As String

retcode = check_apps(login_handle, no_of_elements,
str_array(), handle)

For i = 1 To UBound(str_array)
Debug.Print str_array(i)
Next i

This code worked absolutely fine untill I upgraded this to VB 2005 .
Now str_array() is not filled with data but the no_of_elements comes
correctly , following is the upgraded code :

Declare Function vb_inq_applications Lib "tcvbodss.dll" (ByVal
login_handle As Short, ByRef no_of_elements As Short, ByRef
str_array() As String, ByRef handle As Short) As Short

Dim handle As Integer
Dim no_of_elements As Integer
Dim str_array(16) As String
ReDim str_array(16)

retcode = check_apps(login_handle, no_of_elements, str_array,
handle)

For i = 1 To UBound(str_array)
Console.WriteLine str_array(i)
Next i

I am unable to locate the PROBLEM , kindly help me to short out this
issue.

Aug 9 '07 #1
1 4266
Hi Phoenix,

Try the following :

Declare Function vb_inq_applications Lib "tcvbodss.dll" ( _
ByVal login_handle As Int16, _
ByRef no_of_elements As Int16, _
<InAttribute(), OutAttribute(), MarshalAs(UnmanagedType.SafeArray)ByRef
str_array() As String, _
ByRef handle As Int16) As Int16

Dim handle As Int16
Dim no_of_elements As Int16
Dim str_array(16) As String

retcode = check_apps(login_handle, no_of_elements, str_array,
handle)

For i = 0 To UBound(str_array)
Console.WriteLine str_array(i)
Next i
If that doesn't work try changing the str_array to ByVal instead of ByRef in
the vb_inq_applications declaration.

Regards,

Bill


"Phoenix" <su************@gmail.comwrote in message
news:11**********************@g12g2000prg.googlegr oups.com...
Hi Friends,

Any help would be highly appreciated for the following problem :

I have a vb 6 application which makes call to an API in some dll
which returns an array of strings and no of elements in that array :

Declare Function vb_inq_applications Lib "tcvbodss.dll" (ByVal
login_handle As Integer, ByRef no_of_elements As Integer, ByRef
str_array() As String, ByRef handle As Integer) As

Integer

Dim handle As Integer
Dim no_of_elements As Integer
Dim str_array(16) As String

retcode = check_apps(login_handle, no_of_elements,
str_array(), handle)

For i = 1 To UBound(str_array)
Debug.Print str_array(i)
Next i

This code worked absolutely fine untill I upgraded this to VB 2005 .
Now str_array() is not filled with data but the no_of_elements comes
correctly , following is the upgraded code :

Declare Function vb_inq_applications Lib "tcvbodss.dll" (ByVal
login_handle As Short, ByRef no_of_elements As Short, ByRef
str_array() As String, ByRef handle As Short) As Short

Dim handle As Integer
Dim no_of_elements As Integer
Dim str_array(16) As String
ReDim str_array(16)

retcode = check_apps(login_handle, no_of_elements, str_array,
handle)

For i = 1 To UBound(str_array)
Console.WriteLine str_array(i)
Next i

I am unable to locate the PROBLEM , kindly help me to short out this
issue.
Aug 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Richard | last post by:
Here is the program problem: Month with 30 days have 720 hours, and month with 31 days have 744 hours. February, with 28 days, has 672 hours. Enhance the input validation of the program code...
23
by: Nascimento | last post by:
Hello, How to I do to return a string as a result of a function. I wrote the following function: char prt_tralha(int num) { int i; char tralha;
204
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 =...
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
1
by: Joe Cool | last post by:
Using VB.NET 2005. I will not go into detail on a problem I can't figure out, but I will describe it simple terms that should convey the underlying issue. I have a class called ClassA. It has...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
14
by: Shhnwz.a | last post by:
Hi, I am in confusion regarding jargons. When it is technically correct to say.. String or Character Array.in c. just give me your perspectives in this issue. Thanx in Advance.
0
by: Phoenix | last post by:
Hi Friends, Any help would be highly appreciated for the following problem : I have a vb 6 application which makes call to an API in some dll which returns an array of strings and no of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.