Returns the lowest available subscript for the indicated dimension of an array.
Public Function LBound( _ ByVal Array As System.Array, _ Optional ByVal Rank As Integer = 1 _ ) As Integer
Exception type | Error number | Condition |
---|---|---|
9 | Array is Nothing. | |
9 | Rank < 1 or Rank is greater than the rank of Array. |
Since array subscripts start at 0, the lowest available subscript for every dimension is always 0.
For an array with the following dimensions, LBound returns the values in the following table:
Dim A(100, 5, 4) As Byte
Call to LBound | Return value |
---|---|
LBound(A, 1) |
0 |
LBound(A, 2) |
0 |
LBound(A, 3) |
0 |
This example uses the LBound function to determine the lowest available subscript for the indicated dimension of an array.
Dim Lowest, MyArray(10, 15, 20), AnyArray(6) as Integer Lowest =LBound(
MyArray,
1)
' Returns 0. Lowest =LBound(
MyArray,
3)
' Returns 0. Lowest =LBound(
AnyArray)
' Returns 0.
UBound Function | Dim Statement | ReDim Statement |