-
I don't know if anyone could help me with this problem but if they could i would appreciate it.
Anyway I have set up a dynamic 2Dimensional array. I found that it can only be re-sized once and after that I get a subscript out of range. 1D Arrays re-size ok in the same situation. Am I doing something wrong or is this simply a bug with Vb and anyone know a way round it
This bit would go in the genral declerations
Dim MyArray() As Variant
Command1_Click() 'you get the idea
ReDim MyArray(1,1) As Variant 'This works
ReDim MyArray(2,2) As Variant
'The second dimming of the array brings up the error out of subscript
Right for anyone who is interested I now know the problem which is a limitation of 2d Arrays when you re-size them
Only the last dimension can be altered. So an Array can be changed from (1,1) to (1,2) for example but not (1,1) to (2,1).
thanks for everyones help
This below doesn't work either
ReDim MyArray(1,1)
ReDim MyArray(2,2)
Or if i use variables instead of numbers
[Edited by eble1 on 09-10-2000 at 10:59 AM]
-
<?>
let's see a sampling of the code causing the problem please!
-
How about:
Code:
Dim MyArray() As Variant
Public Sub Command1_Click()
ReDim MyArray(1,1)
ReDim My Array(2,2)
End Sub
Don't redefine the array's type.
-
Not expert, but try this
What if in the Gen Dec area, you use
Public MyArray as Variant.
Also have you tested only the 2D Array (redim marray(2,2)) by itself?