Array(required; any array)
The array to be searched
The object that is searched for
The index at which to start the search
The number of elements to search
An Integer containing the index of the last occurrence of
Returns the index of the last occurrence of
Array must be a one-dimensional array.
The LastIndexOf method has the same syntax as the IndexOf method and works the same way as IndexOf, except that it searches from the end of the array and returns the largest index of a matching element.
By default, the LastIndexOf method searches for
Value from the end to the beginning of
startIndex is provided without
count, LastIndexOf searches from
startIndex to the first element of
count are provided, the method searches
count elements backward starting at
startIndex. In other words, it searches
array(startIndex - count + 1).
startIndex is present and is outside of
the range of the elements in
method returns -1.
count is present and
startIndex < count -
method call generates an ArgumentOutOfRangeException exception.
The following code searches for a value in an Integer array:
Dim i As Integer Dim a(100000) As Integer For i = 0 To 99999 a(i) ...