This documentation is archived and is not being maintained.

ReDim Statement Changes in Visual Basic

Visual Basic .NET updates declaration with the ReDim statement for simplification and improved readability.

Visual Basic 6.0

In Visual Basic 6.0, you can use the ReDim statement to serve as the initial declaration of a dynamic array. The array does not have to be declared anywhere else.

Visual Basic 6.0 also allows you to change the rank of an array with ReDim, as in the following example:

Dim X(10) As Single 
ReDim X(10, 10) 

Visual Basic .NET

In Visual Basic .NET, you cannot use ReDim as a declaration. You must declare an array just like any other variable, using Dim or an equivalent statement, before it can appear in a ReDim statement.

You cannot change the rank of an array in Visual Basic .NET. The code in the preceding example causes an error.

See Also

ReDim Statement | Dim Statement | Programming Element Support Changes Summary