Array.IndexOf(T) searches for the object and returns the index of the first occurrence
Imports System
Public Class Example
Public Shared Sub Main()
Dim numbers() As String = { "One", "Two", "Three", "XXX","Four", "One", "Five" }
For Each num As String In numbers
Console.WriteLine(num)
Next
Console.WriteLine(Array.IndexOf(numbers, "One"))
Console.WriteLine(Array.IndexOf(numbers, "One", 3))
Console.WriteLine(Array.IndexOf(numbers, "One", 2, 2))
End Sub
End Class
Related examples in the same category