How to clear the entire array?
You can either use the Erase
or ReDim
statements to clear the array. Examples of each are shown in the MSDN documentation. For example:
Dim threeDimArray(9, 9, 9), twoDimArray(9, 9) As IntegerErase threeDimArray, twoDimArrayReDim threeDimArray(4, 4, 9)
To remove a collection, you iterate over its items and use the Remove
method:
For i = 1 to MyCollection.Count MyCollection.Remove 1 ' Remove first itemNext i