You can re-dim an array at a higher value and it will retain the old data. Problem with this is it only works with single dimension arrays.
The example below will show how multi-dimension arrays seem to loose data:
cMax = 1
pMax = 3
Dim Array[ cMax,pMax ]
Array[ 1,1 ] = 1
Array[ 1,2 ] = 2
Array[ 1,3 ] = 3
cMax = 2
pMax = 3
Dim Array[ cMax,pMax ]
Array[ 2,1 ] = 4
Array[ 2,2 ] = 5
Array[ 2,3 ] = 6
Do
For d1 = 1 to cMax
For d2 = 1 to pMax
Print( "Array[" + Str( d1 ) + "," + Str( d2 ) + "] = " + Str( Array[ d1,d2 ] ) )
Next d2
Next d1
Sync( )
Loop
The only work around to this that I've found is not exactly one that I'm a fan of. It's to Dim a temporary array at the old size and collect the data from your main array. Dim your main array to its new size and then loop through your main array and add the data from the temporary array back into your main array. This is show in the code below:
cMax = 1
pMax = 3
Dim Array[ cMax,pMax ]
Array[ 1,1 ] = 1
Array[ 1,2 ] = 2
Array[ 1,3 ] = 3
Dim Temp[ cMax,pMax ]
For c = 1 to cMax
For p = 1 to pMax
Temp[ c,p ] = Array[ c,p ]
Next p
Next c
cMax = 2
pMax = 3
Dim Array[ cMax,pMax ]
Array[ 2,1 ] = 4
Array[ 2,2 ] = 5
Array[ 2,3 ] = 6
For c = 1 to cMax - 1
For p = 1 to pMax
Array[ c,p ] = Temp[ c,p ]
Next p
Next c
Do
For d1 = 1 to cMax
For d2 = 1 to pMax
Print( "Array[" + Str( d1 ) + "," + Str( d2 ) + "] = " + Str( Array[ d1,d2 ] ) )
Next d2
Next d1
Sync( )
Loop
Sean