473,396 Members | 2,020 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,396 software developers and data experts.

1-based index array issue

Hi all, I need some help here.

I have an ActiveX object that requires me to pass in an array that is
1-based (as opposed to the normal 0-based index). Unfortunately the author
of the ActiveX defines a 1-based array (to be passed to it) ByRef. So as far
as I can tell I need to pass it a 1-based array. I'm new to .NET but I've
done some homework here and I know that the VB 6.0 "Option Base 1" and like
alternatives are no longer supported. I have also gone back to the developer
of the ActiveX object and asked them to write the #$%! object so I could
pass in a 0-based array, but that has gotten me nowhere.

Any tips, hints, advice or solutions will be greatly appreciated. I've
attempted to add an extra row/column to the arrays and a properly bounded
0-based array with no success. Here is some simplified sample code the
author provided so you have an idea what I'm trying to do.
Dim aryHdrParamList(1 To 4)
Dim aryLineParamMatrix(1 To 30, 1 To 5)

aryHdrParamList(1) = "1"
aryHdrParamList(2) = "1"
aryHdrParamList(3) = "2GXCL0000"
aryHdrParamList(4) = "NONE"

aryLineParamMatrix(1, 1) = "0532"
aryLineParamMatrix(1, 2) = Empty

Set objMethod = CreateObject("Server.Service")
Call objMethod.GetInfo(aryHdrParamList, aryLineParamMatrix)

MsgBox aryHdrParamList(1) & " " & aryHdrParamList(2) & " " &
aryHdrParamList(3)
MsgBox aryLineParamMatrix(1, 1) & aryLineParamMatrix(1, 4) & " " &
aryLineParamMatrix(1, 5)
Nov 20 '05 #1
3 5550
I don't see why the indexing would matter between the two objects. If you
create an array in VB.NET that is 0 bassed, say with elements starting at 0
to 4 (5 elements) and then pass it to an object that takes the array, that
object woul djust address them using 1 as the first element.

"John Dolan" <jo**@coole.com> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all, I need some help here.

I have an ActiveX object that requires me to pass in an array that is
1-based (as opposed to the normal 0-based index). Unfortunately the author
of the ActiveX defines a 1-based array (to be passed to it) ByRef. So as far as I can tell I need to pass it a 1-based array. I'm new to .NET but I've
done some homework here and I know that the VB 6.0 "Option Base 1" and like alternatives are no longer supported. I have also gone back to the developer of the ActiveX object and asked them to write the #$%! object so I could
pass in a 0-based array, but that has gotten me nowhere.

Any tips, hints, advice or solutions will be greatly appreciated. I've
attempted to add an extra row/column to the arrays and a properly bounded
0-based array with no success. Here is some simplified sample code the
author provided so you have an idea what I'm trying to do.
Dim aryHdrParamList(1 To 4)
Dim aryLineParamMatrix(1 To 30, 1 To 5)

aryHdrParamList(1) = "1"
aryHdrParamList(2) = "1"
aryHdrParamList(3) = "2GXCL0000"
aryHdrParamList(4) = "NONE"

aryLineParamMatrix(1, 1) = "0532"
aryLineParamMatrix(1, 2) = Empty

Set objMethod = CreateObject("Server.Service")
Call objMethod.GetInfo(aryHdrParamList, aryLineParamMatrix)

MsgBox aryHdrParamList(1) & " " & aryHdrParamList(2) & " " &
aryHdrParamList(3)
MsgBox aryLineParamMatrix(1, 1) & aryLineParamMatrix(1, 4) & " " &
aryLineParamMatrix(1, 5)

Nov 20 '05 #2
I thought this as well, but since, and this is my assumption, the arrays are
passed ByRef its not possible. The one thing I do know for sure is that if I
pass it a zero-based array I will get an "array out of bounds" error, but if
I pass it as one-based it works fine.

For example the code below works with:
Dim aryHdrParamList(1 To 4)

But fails with either:
Dim aryHdrParamList(4)

Or:
Dim aryHdrParamList(5) -- where I would leave aryHdrParamList(0) empty.
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
I don't see why the indexing would matter between the two objects. If you
create an array in VB.NET that is 0 bassed, say with elements starting at 0 to 4 (5 elements) and then pass it to an object that takes the array, that
object woul djust address them using 1 as the first element.

"John Dolan" <jo**@coole.com> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all, I need some help here.

I have an ActiveX object that requires me to pass in an array that is
1-based (as opposed to the normal 0-based index). Unfortunately the author of the ActiveX defines a 1-based array (to be passed to it) ByRef. So as

far
as I can tell I need to pass it a 1-based array. I'm new to .NET but I've done some homework here and I know that the VB 6.0 "Option Base 1" and

like
alternatives are no longer supported. I have also gone back to the

developer
of the ActiveX object and asked them to write the #$%! object so I could
pass in a 0-based array, but that has gotten me nowhere.

Any tips, hints, advice or solutions will be greatly appreciated. I've
attempted to add an extra row/column to the arrays and a properly bounded 0-based array with no success. Here is some simplified sample code the
author provided so you have an idea what I'm trying to do.
Dim aryHdrParamList(1 To 4)
Dim aryLineParamMatrix(1 To 30, 1 To 5)

aryHdrParamList(1) = "1"
aryHdrParamList(2) = "1"
aryHdrParamList(3) = "2GXCL0000"
aryHdrParamList(4) = "NONE"

aryLineParamMatrix(1, 1) = "0532"
aryLineParamMatrix(1, 2) = Empty

Set objMethod = CreateObject("Server.Service")
Call objMethod.GetInfo(aryHdrParamList, aryLineParamMatrix)

MsgBox aryHdrParamList(1) & " " & aryHdrParamList(2) & " " &
aryHdrParamList(3)
MsgBox aryLineParamMatrix(1, 1) & aryLineParamMatrix(1, 4) & " " &
aryLineParamMatrix(1, 5)


Nov 20 '05 #3
Oops. Had some issues with my newsgroup reader... the message above is from
me.

Thanks

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
I don't see why the indexing would matter between the two objects. If you
create an array in VB.NET that is 0 bassed, say with elements starting at 0 to 4 (5 elements) and then pass it to an object that takes the array, that
object woul djust address them using 1 as the first element.

"John Dolan" <jo**@coole.com> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all, I need some help here.

I have an ActiveX object that requires me to pass in an array that is
1-based (as opposed to the normal 0-based index). Unfortunately the author of the ActiveX defines a 1-based array (to be passed to it) ByRef. So as

far
as I can tell I need to pass it a 1-based array. I'm new to .NET but I've done some homework here and I know that the VB 6.0 "Option Base 1" and

like
alternatives are no longer supported. I have also gone back to the

developer
of the ActiveX object and asked them to write the #$%! object so I could
pass in a 0-based array, but that has gotten me nowhere.

Any tips, hints, advice or solutions will be greatly appreciated. I've
attempted to add an extra row/column to the arrays and a properly bounded 0-based array with no success. Here is some simplified sample code the
author provided so you have an idea what I'm trying to do.
Dim aryHdrParamList(1 To 4)
Dim aryLineParamMatrix(1 To 30, 1 To 5)

aryHdrParamList(1) = "1"
aryHdrParamList(2) = "1"
aryHdrParamList(3) = "2GXCL0000"
aryHdrParamList(4) = "NONE"

aryLineParamMatrix(1, 1) = "0532"
aryLineParamMatrix(1, 2) = Empty

Set objMethod = CreateObject("Server.Service")
Call objMethod.GetInfo(aryHdrParamList, aryLineParamMatrix)

MsgBox aryHdrParamList(1) & " " & aryHdrParamList(2) & " " &
aryHdrParamList(3)
MsgBox aryLineParamMatrix(1, 1) & aryLineParamMatrix(1, 4) & " " &
aryLineParamMatrix(1, 5)


Nov 20 '05 #4

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

Similar topics

8
by: eft0 | last post by:
Hi there, the question: I have this array: var Thumbnails = new Array(); Thumbnails = new Array('1', 'listing_34.jpg', 'Home View'); Thumbnails = new Array('2', 'sexy2.jpg', 'Sexy');...
6
by: eft0 | last post by:
Thanks to all who answer my preview post. Now I'll try to describe what I'm doing and what doesn't work. I'm doing a code to move objects (images) in a specified user order, through arrow up...
1
by: Hal Styli | last post by:
hello, can someone please help... Im interested in the use of an auxiliary array to act like pointers for another array, allowing the sort order to be traversed. See code below. I dont have an...
6
by: Anjali | last post by:
Hi, I am handling an array with a hexadecimal index for the first time. What actually does the below means. arr = { '@','£','$','@','@','@','@','@','@','@', 10,'@', 13,'@','@','@',...
4
by: Eric Sabine | last post by:
I've simplified the code to the following. I'm just overlooking something very simple I'm sure. Dim mic() As MenuItem mic = New MenuItem(3) {} mic(0) = New MenuItem("a") mic(0).Index = 1 ...
1
by: Manuel Canas | last post by:
Hi There, I have been batleing with this now that I'm at the end of my rop here. What I'm doing here is this; 1 - retrieving some data from the database with a data reader (with a search...
1
by: newbie | last post by:
Hello All, I'm trying to figure out this array problem I have. I don't know if I'm doing this correctly. Anyone want to take a look. --------------------- Current Situation....
2
by: newbie | last post by:
Hello All, I'm trying to figure out this array problem I have. I don't know if I'm doing this correctly. Anyone want to take a look. --------------------- Current Situation....
1
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.