Problem with an object of multidimensional array

C

Chris Lee

I have a vexing problem with an object of multidimensional array. The
function
I call (an external com function) is supposed to return a 2-D array
that looks like this: (0,0), (1,0) ......, (n,0).

Here is a snippet of my code

Dim oResults as object
Dim row as integer

oResults = GetMultidimensionalArray() 'This returns a 2-D array
of strings
For row = 0 to oResults.GetUpperBound(0)
Console.Writeline oResults(row,0).getvalue(row,0)
next

This failed to return the required list of strings. I can see from the
Watch screen that the 2-D array contains strings.
 
N

NM

Hi,

Try this, perhaps it works :

Dim oResults as String()() = GetMultidimensionalArray()

For row As Integer = 0 To UBound(oResults)

Console.Writeline oResults(row, 0)

Next



Chris Lee said:
I have a vexing problem with an object of multidimensional array. The
function
I call (an external com function) is supposed to return a 2-D array
that looks like this: (0,0), (1,0) ......, (n,0).

Here is a snippet of my code

Dim oResults as object
Dim row as integer

oResults = GetMultidimensionalArray() 'This returns a 2-D array
of strings
For row = 0 to oResults.GetUpperBound(0)
Console.Writeline oResults(row,0).getvalue(row,0)
next

This failed to return the required list of strings. I can see from the
Watch screen that the 2-D array contains strings.


Regards;
 
C

Chris Lee

Sorry, it returns an object with the following structure. I dont know
how to call it as it is a combination of a multidimensional and jagged
array:

oResult(m,n)(x,y) with each element storing a string

The result may appear as such:

oResult(i,0) -> string array of (50,1)
oResult(i,1) -> string array of (3,4)
oResult(i,2) -> string array of (10,6)

-> means points to.

How do I a pass a reference of this object to a string array so that I
can retrieve the information.

I have tried the following:

For i = 0 to Ubound(oResult(0,0),1)
For j = 0 to ubound(oResult(0,0),2)
Dim StringArray(,) as String = oResult(i,j)
'Process data here
Next j
Next i

No success.
 
N

NM

Chris Lee said:
Sorry, it returns an object with the following structure. I dont know
how to call it as it is a combination of a multidimensional and jagged
array:

oResult(m,n)(x,y) with each element storing a string

The result may appear as such:

oResult(i,0) -> string array of (50,1)
oResult(i,1) -> string array of (3,4)
oResult(i,2) -> string array of (10,6)

-> means points to.

How do I a pass a reference of this object to a string array so that I
can retrieve the information.

I have tried the following:

For i = 0 to Ubound(oResult(0,0),1)
For j = 0 to ubound(oResult(0,0),2)

Dim StringArray(,) as String = oResult(i,j)

' => oResult (dimension1, dimension2) (dimension3, dimension4)
Dim StringArray(,) as String = oResult(0,0)(i,j)

'Process data here
Next j
Next i

No success.

Regards
 
C

Chris Lee

Thanks! Your suggestion works fine!

NM said:
' => oResult (dimension1, dimension2) (dimension3, dimension4)
Dim StringArray(,) as String = oResult(0,0)(i,j)



Regards
 

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