Passing a Multi-Dimensional Array

G

Guest

I have looked all over and I cannot find an example or information on passing
a multi-dimensional array. Well, that is not true. I found a close example
in C++ but it didn't work when I "converted it" to VB.Net.

My receiving method looks like this:

Public DoIt(ByRef Array( , ) as string) as boolean

but what I am not clear on is what the parameter looks like in my calling
routine:

Dim result as boolean
result = DoIt(Array(???))

Thoughts?
 
H

Herfried K. Wagner [MVP]

SQLScott said:
I have looked all over and I cannot find an example or information on
passing
a multi-dimensional array. Well, that is not true. I found a close
example
in C++ but it didn't work when I "converted it" to VB.Net.

My receiving method looks like this:

Public DoIt(ByRef Array( , ) as string) as boolean

but what I am not clear on is what the parameter looks like in my calling
routine:

Dim result as boolean
result = DoIt(Array(???))

\\\
Dim Data(2, 2) As Object
....
Foo(Data)

' Alternative.
Foo( _
New Object(2, 2) { _
{2, 3, 4}, _
{3, 4, 5}, _
{6, 7, 8} _
} _
)
..
..
..
Public Sub Foo(ByVal Data(, ) As Object)
...
End Sub
///
 
G

Guest

Thanks Herfried. I was able to get it to work in my simple test app
beautifully, but when i tried to implement it in my Web Service, it returned
the following error:

WebService.MethodName can not be reflected.--> Multi-dimensional arrays are
not supported. Use a jagged array instead.

Oh well...back to the drawing board!

Scott
 
G

Guest

Another related, but unresolved, issue.

vb.net 2002
A public multi-dimensional array(10,10,10) with public indices i,j,k in
Module1 does not pass information between forms. A one-dimensional
array(1000), or a scalar does. How come?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top