Revision [9900]

This is an old revision of KeyPgPreserve made by JeffMarshall on 2007-07-22 20:49:29.



Used with KeyPgRedim Redim to preserve contents will resizing an array

Used with KeyPgRedim Redim so that when an array is resized, data is not reset but is preserved. This means when the array is enlarged that only new data is reset, while the old data remains the same.
In arrays with more than one dimension, only the first subscription can be redimensioned (arrays are stored in row-major order, so it's the first, not the last subscription).

ReDim array(1 To 3) As Integer
Dim i As Integer

array(1) = 10
array(2) = 5
array(3) = 8

ReDim Preserve array(2 To 10)

For i = 2 To 10
    Print "array("; i; ") = "; array(i)

Differences from QB:
See also:
Back to Array Functions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki phatcode