Use of IndexOf-Array in VB.NET
To locate the index of a String, and then continue locating further instances we can accomplish this with a IndexOf method.
Arrays are using for store similar data types grouping as a single unit, the items in an array are indexed by their position in the array, numbered beginning with 0 (zero) for the first element in the array and the upper bound of an array is generally language and possibly system specific. We can access Array elements by its numeric index. To access array elements by its index we use IndexOf String Function which is available in the .NET Framework's base class library, using this you can locate the any index of an array.
Sometimes you need to locate the first index of a String, and then continue locating further instances. You can accomplish this with a Do While construct and the IndexOf method.
In the following program , we declare an Array "values" capability of five integer values and. Next step is to retrieve the elements of the Array using a For loop. For finding the index of first and third index of the values we used the IndexOf function of Array.
Public Class Main
Shared Sub Main(ByVal args As String())
Dim values(5) As Integer
For i As Integer = 0 To 5
values(i) = i
Console.WriteLine("Index of first value is :")
Console.WriteLine("Index of third value is :")