Array declarations cannot specify lower bounds
Arrays always have a lower bound of zero. You can specify zero as the lower bound to make your code more readable. However, you cannot specify any other value for the lower bound.
Error ID: BC30805
To correct this error
Dimension arrays as one less than the total number of elements. For example, Dim y(6) has the same size (7 elements) as Dim x(3 To 9). You can also specify Dim y(0 To 6).
Use offsets to simulate nonzero lower bounds. The following example simulates an array dimensioned from 3 to 9.
Const offset As Integer = 3 Dim arrayIndex As Integer ' arrayIndex can vary between 3 and 9. Dim y(0 To 6) ' The preceding statement allocates the same number of elements ' as Dim y(3 To 9). y(arrayIndex - offset) = value ' The preceding statement converts arrayIndex to the ' corresponding index of y.
See Also
Tasks
How to: Specify a Zero Lower Bound on an Array
Concepts
Array Dimensions in Visual Basic