Searches for the last occurrence of the duplicated value in the first section of the Array.
Imports System Imports Microsoft.VisualBasic Public Class SamplesArray Public Shared Sub Main() Dim myArray As Array = Array.CreateInstance(GetType(String), 12) myArray.SetValue("1", 0) myArray.SetValue("2", 1) myArray.SetValue("3", 2) myArray.SetValue("4", 3) myArray.SetValue("5", 4) myArray.SetValue("6", 5) myArray.SetValue("7", 6) myArray.SetValue("8", 7) myArray.SetValue("4", 8) myArray.SetValue("10", 9) myArray.SetValue("11", 10) myArray.SetValue("12", 11) PrintIndexAndValues(myArray) Dim myIndex As Integer = Array.LastIndexOf(myArray, 8) Console.WriteLine(myIndex) End Sub Public Shared Sub PrintIndexAndValues(ByVal myArray As Array) Dim i As Integer For i = myArray.GetLowerBound(0) To myArray.GetUpperBound(0) Console.WriteLine(myArray.GetValue(i)) Next i End Sub End Class