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 AsNew
Label()
Since arrays are classes, New can create a new array instance:
Dim MyArray As Integer()
MyArray = New
Integer() {0, 1, 2, 3}
The New keyword is used in this context:
Visual Basic Language Keywords |