Class System.Array Syntax Dim result As Integer = Array.LastIndexOf(array, _ value[, startIndex[, count]]) array (required; any array) The array to be searched. value (required; any) The object that is searched for in the array. startIndex (optional; Integer) The index at which to begin the search. If omitted, the search begins with the last element of the array. count (optional; Integer) The number of items to search. If omitted, the search continues to the beginning of the array. This count moves backward. If startIndex is 6 and count is 3, items 6, 5, and then 4 are examined. Description The LastIndexOf method returns the index of the last occurrence of value in array, or -1 if value was not found within the range searched. Usage at a Glance 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. Specifying a count value that goes past the beginning of the array results in an error. Example See the example for the Array.IndexOf Method entry, as the use of the LastIndexOf method is identical. See Also Array Class, Array.IndexOf Method |