Variables in Declaring an Array
you can't but you have 2 options.
You can declare const like const MAX_ITEMS AS INTEGER before declaring
variables (see example 1)
Another option is not using a fixed array but a variable size array
(see example 2)
Hope this helps.
example 1
CONST MAX_ITEMS AS INTEGER=10
Dim myArray(0 To MAX_ITEMS ) As String
Example 2
option base 1
dim n as integer
dim myArray() as string
n=15
redim myArray(1 to n)
Jimmy wrote:
Dim myArray(0 To n) As String
The dimensions of this array change throughout.
Why can't I use the variable 'n' in the declaration?
And, more importantly, can someone help me solve this problem?
Thanks,
Jimmy
|