Kardi Teknomo
Kardi Teknomo Kardi Teknomo Kardi Teknomo
     
 
Research
Publications
Tutorials
Resume
Personal
Resources
Contact

 


How to Delete an Array?

 

When you delete an array, you do not delete the name of the variable but the content of it. In other words, you reinitialize the elements of fixed-size arrays and releases dynamic-array storage space.
Syntax: Erase arrayName

Before you can use the same array variable again, you need to re-declare it size using ReDim.

Example:

' Declare array variables.
Dim NumArray(10) As Integer ' Integer array.
Dim StrVarArray(10) As String ' Variable-string array.
Dim VarArray(10) As Variant ' Variant array.
Dim DynamicArray() As Integer ' Dynamic array.

ReDim DynamicArray(10) ' Allocate storage space.

Erase NumArray ' Each element set to 0.
Erase StrVarArray ' Each element set to zero-length string ("").
Erase VarArray ' Each element set to Empty.
Erase DynamicArray ' Free memory used by array.

<Previous lesson | Table of Content | Content of this Chapter | Next lesson>

 
 
© 2006 Kardi Teknomo. All Rights Reserved.
Designed by CNV Media