Hi all, i have created a string array from A-Z, which will contain index from 0-25.
Then i have a textbox and when i enter text into the textbox, how can i get the index number of the array associated with the text i entered?
For example, i enter "AB" into the textbox, the index return should be 0 and 1.
The code below only able to return the index if i enter only 1 letter alphabet. Can someone pls guide me on how to return the index number for many alphabets. Thanks
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim abc(25) As String
abc(0) = "a"
abc(1) = "b"
abc(2) = "c"
abc(3) = "d"
abc(4) = "e"
abc(5) = "f"
abc(6) = "g"
abc(7) = "h"
abc(8) = "i"
abc(9) = "j"
abc(10) = "k"
abc(11) = "l"
abc(12) = "m"
abc(13) = "n"
abc(14) = "o"
abc(15) = "p"
abc(16) = "q"
abc(17) = "r"
abc(18) = "s"
abc(19) = "t"
abc(20) = "u"
abc(21) = "v"
abc(22) = "w"
abc(23) = "x"
abc(24) = "y"
abc(25) = "z"
Dim result = abc.Where(Function(a) a.Contains(TextBox2.Text)).Select(Function(s) Array.IndexOf(abc, s)).ToArray()
Dim x As Integer
For Each x In result
MsgBox(x)
Next
End Sub