Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.26 KB

erase-statement.md

File metadata and controls

42 lines (29 loc) · 1.26 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Erase Statement (Visual Basic)
Erase Statement
07/20/2015
vb.Erase
Erase keyword [Visual Basic]
Erase statement [Visual Basic]
7a8133d7-b750-4d74-8b66-ba1dd9778d4b

Erase Statement (Visual Basic)

Used to release array variables and deallocate the memory used for their elements.

Syntax

Erase arraylist  

Parts

arraylist
Required. List of array variables to be erased. Multiple variables are separated by commas.

Remarks

The Erase statement can appear only at procedure level. This means you can release arrays inside a procedure but not at class or module level.

The Erase statement is equivalent to assigning Nothing to each array variable.

Example

The following example uses the Erase statement to clear two arrays and free their memory (1000 and 100 storage elements, respectively). The ReDim statement then assigns a new array instance to the three-dimensional array.

[!code-vbVbVbalrStatements#19]

See also