471,089 Members | 1,097 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Passing a Multi-Dimensional Array

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?

--
Thanks,

Scott
Nov 21 '05 #1
3 9162
"SQLScott" <SQ******@discussions.microsoft.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
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

"Herfried K. Wagner [MVP]" wrote:
"SQLScott" <SQ******@discussions.microsoft.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
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?
"SQLScott" wrote:
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?

--
Thanks,

Scott

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Amr Mostafa | last post: by
7 posts views Thread by Harolds | last post: by
2 posts views Thread by Curtis Justus | last post: by
2 posts views Thread by Les Peabody | last post: by

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.