|
-
Sep 9th, 2000, 03:51 PM
#1
Thread Starter
New Member
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]
-
Sep 9th, 2000, 03:54 PM
#2
_______
<?>
let's see a sampling of the code causing the problem please!
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 04:15 PM
#3
Monday Morning Lunatic
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.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 9th, 2000, 07:01 PM
#4
PowerPoster
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?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|