CST2601 Visual
Basic I
Notes on LBound and UBound
LBound FunctionReturns a Long containing the smallest available subscript for the indicated dimension of an array. Syntax LBound(arrayname[, dimension]) The LBound function syntax has these parts:
Remarks The LBound function is used with the UBound function to determine the size of an array. Use the UBound function to find the upper limit of an array dimension. LBound returns the values in the following table for an array with the following dimensions:
The default lower bound for any dimension is either 0 or 1, depending on the setting of the Option Base statement. The base of an array created with the Array function is zero; it is unaffected by Option Base. Arrays for which dimensions are set using the To clause in a Dim, Private, Public, ReDim, or Static statement can have any integer value as a lower bound. LBound Function ExampleThis example uses the LBound function to determine the smallest available subscript for the indicated dimension of an array. Use the Option Base statement to override the default base array subscript value of 0.
UBound FunctionReturns a Long containing the largest available subscript for the indicated dimension of an array. Syntax UBound(arrayname[, dimension]) The UBound function syntax has these parts:
Remarks The UBound function is used with the LBound function to determine the size of an array. Use the LBound function to find the lower limit of an array dimension. UBound returns the following values for an array with these dimensions:
UBound Function ExampleThis example uses the UBound function to determine the largest available subscript for the indicated dimension of an array.
|