2 dim array

Netnoobie

Regular
Joined
Feb 6, 2003
Messages
94
Location
Philadelphia
Ok, so I haven't touched these in a long time and I can't quite recall how to populate them. Here's what I have:

I have two digits (say 180 and 200) and need to store the data like (1,180) (2,181) (3,183) etc. How can I dynamically declare the array and populate it like that? I can get the numbers in between, but I need to save it all in an array like that and that's where my memory is foggy.

Declare like: Dim arNumber(x, y) As Integer ? Populating the correct coordinates is also where I think I forced myself to forget it all.

Many thanks.
 
Visual Basic:
Public Structure MyNumbers
    Public MyNum1 as Integer
    Public MyNum2 as Integer
End Structure

Public Class Class1
     Dim MyArray() as MyNumbers

     Public Sub CreateArray()
        Redim MyArray(3)
        With MyArray(1)
              .MyNum1 = 50
              .MyNum2 = 100
        End With
     End Sub
End Class
Or
Visual Basic:
Structure ...
Sub ...
 Dim MyArray as ArrayList, Data as MyNumbers
 Data.MyNum1 = 50: Data.MyNum2 = 100
 MyArray.Add(Data)
End Sub
...
If you want to use a "Table"
Visual Basic:
Dim MyArr(,) as Integer
Redim MyArr(200, 200)
MyArr(156, 234) = 10
 
Back
Top