Reputation: 109
i have an array of string like this :
A
B
C
D
E
F
i know how to get the index of one letter in the array string like this
Dim itemindex As String = Array.IndexOf(myarr, "C")
TextBox2.Text = itemindex
It return for me the number 2
but i want to know how to do it in the Reverse way like if i give the index 2 i want it to return for me the letter C ?
i want to do that for tow array withe the same size one in the listbox if i select one item i want it to return for me the item in the second array that have the same index number
Upvotes: 0
Views: 282
Reputation: 6473
Just use myArr(2) to access the 3rd element in the array.
Or to get a character from a string, use SubString e.g.
s.Substring(startIndex, length)
Length for you would be 1, if you're looking for a single character.
Upvotes: 1