Hi,

I am totally lost and I went through a lot of sites about searching within an array, but I could not find any clues. I created the following array :

Private LetterArray() As String = {"A", "B", "C"}

and I don't know how to get the target letter from a "Textbox" and search "SearchButton" for it ?
I have to do the following:
- Get the TargetLetter from the textbox
- Set a Boolean for Found to False (which I did)
- Use for loop For Each Letter in the Array (LetterArray)
- If the Word = the Target
Make Found True
Endif

I appreciate all the help or the hints/sites that I can read for this subject.
Thank you in advance.

It is not quite clear to me what exactly you try but here is maybe the solution:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
		Dim target As String = TextBox1.Text

		Dim index As Integer = Array.IndexOf(LetterArray, target)

		If index = -1 Then
			MsgBox("text not found")
		Else
			MsgBox("found text on position: " & index)
		End If

	End Sub

Be aware the search in case sensitive. so it will find A,B,C but not a,b,c.

Thank you for your quick replay, but what if I want the search to accept both cases (upper case and lower case)?

Define all strings in the LetterArray in Lowercase
Private LetterArray() As String = {"a", "b", "c"}
and change the line:
Dim target As String = TextBox1.Text
to
Dim target As String = TextBox1.Text.tolower

This question has already been answered. Start a new discussion instead.