Fill multi dimensional array

  • Thread starter Thread starter Bob Graham
  • Start date Start date
B

Bob Graham

I'm declaring an array like this

dim subs(,,) as object

Then in the form load procedure I redim:

redim subs(29,0,0)

(I want an array of 30 items with two extra 'properties' that I can access
at very high speed while my app is running)

How do I fill an individual row of this array?

I've tried variations on

subs(i, 0, 0) = {a, b, c}

But I can't figure it out.

Help???

Bob
 
Hi Bob,

An old sample of me it uses the arraylist which is dynamic, and therefore
much faster than what you are using now. (That is created everytime new), It
are 2 dimensions, however when you understand it, it is of course easy to
add a thirth dimension.

(I changed some names because I was using in this sample y, yn and x for the
arraynames which looks a little bit unreadable to me now, so maybe some
typos)

I hope this helps?

Cor
\\\
Dim Arr1 As New ArrayList
For i As Integer = 0 To 9
Dim Arr2 As New ArrayList
For j As Integer = 0 To 4
Arr2.Add(Chr(j + 65))
Next
Arr1.Add(Arr2)
Next
MessageBox.Show(DirectCast(Arr1(2), ArrayList)(2).ToString)
Dim Arr3 As New ArrayList
For j As Integer = 0 To 4
Arr3.Add(Chr(j + 75))
Next
Arr1.Insert(1, Arr3)
MessageBox.Show(DirectCast(Arr1(1), ArrayList)(2).ToString)
///
 
* "Bob Graham said:
dim subs(,,) as object

Then in the form load procedure I redim:

redim subs(29,0,0)

(I want an array of 30 items with two extra 'properties' that I can access
at very high speed while my app is running)

How do I fill an individual row of this array?

I've tried variations on

subs(i, 0, 0) = {a, b, c}

Have a look for "jagged arrays" in documentation, maybe that's what you
are looking for.
 
Back
Top