Vb6: redistributing a 2D dynamic array

I use arrays to store steam properties in accordance with this pressure. Right now I have properties of exactly 9 pressures, so I am using a static array. I would like to be more flexible, so I would like to switch to dynamic arrays.

When I use ReDim foo(1 to i, 1 to 10)in a loop, I completely lose all data except the last line.
When I use ReDim Preserve foo(1 to i, 1 to 10)or ReDim Preserve(i,10), the program gives the error "Runtime Error" 9 ": index out of range." igoes from 1 to 9.

How can I add a row / column to an array full of data without losing them?

+3
source share
1 answer

VB6. MSDN:

Preserve, Visual Basic . Preserve, , , .

, , . , , , .

, :

 Dim IntArray(10, 10, 10) As Integer 
 ReDim Preserve IntArray(10, 10, 20) 
 ReDim Preserve IntArray(10, 10, 15)
+6

All Articles