Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Information.LBound Method

Returns the lowest available subscript for the indicated dimension of an array.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static int LBound(
	Array Array,
	int Rank
)

Parameters

Array
Type: System.Array

Required. Array of any data type. The array in which you want to find the lowest possible subscript of a dimension.

Rank
Type: System.Int32

Optional. Integer. The dimension for which the lowest possible subscript is to be returned. Use 1 for the first dimension, 2 for the second, and so on. If Rank is omitted, 1 is assumed.

Return Value

Type: System.Int32
Integer. The lowest value the subscript for the specified dimension can contain. LBound always returns 0 as long as Array has been initialized, even if it has no elements, for example if it is a zero-length string. If Array is Nothing, LBound throws an ArgumentNullException.

ExceptionCondition
ArgumentNullException

Array is Nothing.

RankException

Rank less than 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

The following example uses the LBound function to determine the lowest available subscript for the indicated dimension of an array.

Dim lowest, bigArray(10, 15, 20), littleArray(6) As Integer
lowest = LBound(bigArray, 1)
lowest = LBound(bigArray, 3)
lowest = LBound(littleArray)
' All three calls to LBound return 0.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft