ReDim Statement for Visual Basic 6.0 Users

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

See Also

Concepts

Programming Element Support Changes Summary

Reference

ReDim Statement (Visual Basic)

Dim Statement (Visual Basic)