Problems on Creating many arrays on the same time

  • Thread starter Thread starter Gene
  • Start date Start date
G

Gene

I want to create many different arrays on the same time,
so I think of the following:
dim "Staff" & "Num" & "(10)" as integer
Can i do the similar things???
because I want to increase the "Num" from 0 to 10,
so I have 10 arrays with different names.
but i find the above statement is not work.
 
Gene said:
dim "Staff" & "Num" & "(10)" as integer
Can i do the similar things???
because I want to increase the "Num" from 0 to 10,

No, search about multi-dimentional arrays
like:
dim Staff(,) as integer
 
use sotto's solution dim x(10,20)

if you are in a very very special case and that doesn't fit, you also can
take

a hashtable.

Dim myData As New Hashtable

myData.Add("Key", "Value")

x = myData.Item("Key")
 
* "Gene said:
I want to create many different arrays on the same time,
so I think of the following:
dim "Staff" & "Num" & "(10)" as integer
Can i do the similar things???
because I want to increase the "Num" from 0 to 10,
so I have 10 arrays with different names.
but i find the above statement is not work.

Create a multi-dimensional array or an array of arrays:

\\\
Dim aint(10, 10) As Integer
///

\\\
Dim aint(10)() As Integer
Dim i As Integer
For i = 0 To 10
aint(i) = New Integer(10) {}
Next i
///
 
THX guys,
I'll try sotto's solution

Herfried K. Wagner said:
Create a multi-dimensional array or an array of arrays:

\\\
Dim aint(10, 10) As Integer
///

\\\
Dim aint(10)() As Integer
Dim i As Integer
For i = 0 To 10
aint(i) = New Integer(10) {}
Next i
///
 
Back
Top