Erase Statement

Syntax

Erase arraylist


arraylist

Use: Required

Data Type: Any

A list of array variables to clear.

Description

Resets the elements of an array to their initial (unassigned) values. In short, Erase "clears out" or empties an array.

Rules at a Glance

  • Specify more than one array to be erased by using commas to delimit arraylist.

  • Fixed array variables remain dimensioned; on the other hand, all memory allocated to dynamic arrays is released.

  • The following table describes how Erase reinitializes the elements of a fixed array.

    Element Data Type Element Reset to...
    Numeric Zero
    Variable-length string Zero-length string ("")
    Fixed-length string Zero
    Boolean False
    Variant Empty
    User-defined type Each member of the user-defined type is treated as a separate variable
    Object Nothing

Programming Tips and Gotchas

Once you use Erase to clear dynamic arrays, they must be redimensioned with ReDim before being used again. This is because Erase releases the memory storage used by the dynamic array back to the operating system, which sets the array to have no elements.

See Also

Dim Statement, ReDim Statement
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.61.195