Redim: Array Already Dimensioned Msg After Dim w/ Subscripts (83238)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q83238 SUMMARY
You can use the ReDim statement to redimension a dynamic array only if
the array has been previously dimensioned with empty parentheses (no
subscripts), or if the array has been previously redimensioned with
ReDim. If you specified subscripts to originally dimension the array
in a Global or Dim statement, or if you previously dimensioned the
array using the Static statement in a Sub or Function, redimensioning
the array will cause an "Array already dimensioned" error.
MORE INFORMATION
You can use the ReDim statement to dimension an array that you have
already declared with empty parentheses either in the Global module or
in the general Declarations section. You can also use ReDim to
redimension arrays that you have dimensioned with ReDim previously
from any Sub or Function procedure.
Therefore, if you need to redimension an array in your program after
using the array, first dimension the array in the Global module using
the Global statement, or in the general Declarations section using Dim
with no subscripts. Then use ReDim with the original dimensions.
Later on, you can redimension this array again with different
subscripts.
This will enable you to change the number of subscripts in each
dimension of an array [for example, from x(15, 15) to x(32, 24)].
However, you cannot use ReDim to change the number of dimensions in an
array. For example, you cannot redimension an array from two
dimensions, such as x(15, 15), to three dimensions, such as
x(64, 1, 5).
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | KB83238 |
---|
|