***?!!!
I'd hate to see what happens to a three deminsional array.Code:Dim myArray()
ReDim Preserve myArray(x, y)
ReDim Preserve myArray(x + 1, y) 'Gives a subscript out of range error
ReDim Preserve myArray(x, y + 1) 'Works!
Printable View
***?!!!
I'd hate to see what happens to a three deminsional array.Code:Dim myArray()
ReDim Preserve myArray(x, y)
ReDim Preserve myArray(x + 1, y) 'Gives a subscript out of range error
ReDim Preserve myArray(x, y + 1) 'Works!
From MSDN (Visual Basic Scripting Edition : ReDim Statement)
So same as VB then!Quote:
The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array.
If you use the Preserve keyword, you can resize only the last array dimension, and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array.
I guess VB sucks, too.Quote:
Originally posted by Jerry Grant
So same as VB then!
yep, i know it suck, you'll need to use a tmp array!
Dim myArray()
Dim tmpArray()
ReDim Preserve myArray(x, y)
ReDim tmpArray(x + 1, y)
tmpArray=myArray()
Erase myArray
myArray=tmpArray()
Erase tmpArray
this should work, i did'nt test it, and never tried it!!
not sure if you really need to use this line
Erase myArray
but i think you need too, not sure!
let me know
I just transposed all my arrays. I only needed to scale the one axis, but because of the type of data in there, it just made since in my mind that that axis be the first.