Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q7013 How Do I Re-Dimension Arrays?

You are here: irt.org | FAQ | VBScript | Q7013 [ previous next ]

You may only re-dimension dynamic arrays. To do so, use the ReDim statement in the same manner as either the Dim, Public, or Private statments. For example to re-dimension an existing dynamic array you could go:

ReDim myArray(5, 5)

Note that using the ReDim statement will reset all data within the array. To keep the data from being erased use the Preserve statement in conjuction with the ReDim statement like so:

ReDim Preserve myArray(5, 5)

There is no limit to the number of times you can resize a dynamic array, but if you make an array smaller than it was, the data in the eliminated elements will be lost.

©2018 Martin Webb