Upgrade Recommendation: Use Zero-Bound Arrays
Visual Basic 6.0 allowed you to define arrays with lower and upper bounds of any whole number. You could also use ReDim to reassign a variant as an array. To enable interoperability with other languages, arrays in Visual Basic .NET must have a lower bound of zero, and ReDim cannot be used unless the array variable was previously declared with the Dim keyword. Although this restricts the way arrays can be defined, it does allow you to pass arrays between Visual Basic .NET and any other .NET language. The following example shows the restriction:
'BAD: LBound must be 0 Dim a(1 To 10) As Integer 'BAD: Can't use ReDim without Dim ReDim v(10) 'OK: Creates an array of 11 integers Dim b(10) As Integer 'OK: Can ReDim previously Dimed variable ReDim b(5) As Integer
A side effect is that the Option Base statement is removed from the language.
When your project is upgraded to Visual Basic .NET, any option base statements are removed from your code. If the array is zero-bound, it is left unchanged. However, if an array is non-zero–bound, then the lower bound is removed and a warning is inserted into the code, as in the following example:
Dim a(1 To 10) As Integer
' UPGRADE_WARNING: Lower bound of an array was changed from 1 to 0. Dim a(10) As Integer
In many cases, the upgraded code will work as it did before. However, if your application logic relies on the lower bound being 1, then you will need to make some modifications. Dim, ReDim, and LBound statements are marked with warnings to help you review the changes.
For this reason, you should use zero-bound arrays in your Visual Basic 6.0 code, avoid using ReDim as an array declaration, and avoid using Option Base 1.