Revision [13612]

This is an old revision of KeyPgPreserve made by AntoniGual on 2008-07-22 00:34:55.

 

PRESERVE


Used with KeyPgRedim Redim to preserve contents will resizing an array

Syntax:
Description:
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 the data is preserved if only the first index is redimensioned (arrays are stored in row-major order, so it's the first, not the last subscription). If indexes other than the first one are redimensioned, the data will not be preserved.

Examples:
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)
Next


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



sf.net phatcode