UBound Function |
Microsoft.VisualBasic.Information
UBound( array [, rank ])
The name of the array
A number specifying the dimension of the array
Integer
Indicates the upper limit of a specified coordinate of an array. The upper boundary is the largest subscript you can use with that coordinate.
To determine the upper limit of the first coordinate of an array, set rank to 1, set it to 2 for the second coordinate, and so on.
If rank is not specified, 1 is assumed.
The function returns -1 if the array is uninitialized .
Note that UBound returns the actual subscript of the upper bound of a particular array dimension.
The number of valid indices for the i th coordinate is equal to UBound(array, i) + 1 .
If array is an uninitialized array, passing it to the UBound function generates an ArgumentNullException exception. To prevent this, you can declare the array as follows :
Dim arrValues(-1) As String