This documentation is archived and is not being maintained.


The New keyword introduces a New clause, which creates a new object instance. The New clause must specify a defined class from which the instance can be created. You can use New in a declaration statement or an assignment statement. When the statement is executed, it calls the constructor of the specified class, passing any arguments you have supplied:

Dim Obj As Object
Obj = New SomeClass("String required by constructor")
' ...
Dim MyLabel As New Label()

Since arrays are classes, New can create a new array instance:

Dim MyArray As Integer()
MyArray = New Integer() {0, 1, 2, 3}

The common language runtime throws an OutOfMemoryException error if there is insufficient memory to create the new instance.

The New keyword is used in this context:

Dim Statement

See Also

Visual Basic Language Keywords | Object Lifetime: How Objects Are Created and Destroyed | Using Constructors and Destructors | OutOfMemoryException Class