This documentation is archived and is not being maintained.

ReDim Statement for Visual Basic 6.0 Users 

Visual Basic 2005 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 2005

In Visual Basic 2005, 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 2005. The code in the preceding example causes an error.

See Also