I am making a program where you enter the info to search into a textbox, then you press a button and it displays the text into a listbox. The code I have so far searches the file but it makes it to where I have to enter a certain amount of letters to search. Where it says (0, 7) I can only search if I put in seven letters, but how do I make it search without having a text limit? Please Help.
The Coding I have so far:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str, any, str2 As String
Dim sr As System.IO.StreamReader
Dim prog As System.IO.File
any = TextBox1.Text
sr = prog.OpenText("thelist.txt")
While sr.Peek <> -1
str = sr.ReadLine
str2 = str.Substring(0, 4)
If any.ToLower = str2.ToLower Then
ListBox1.Items.Add(str)
End If
End While
End Sub
The Coding I have so far:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str, any, str2 As String
Dim sr As System.IO.StreamReader
Dim prog As System.IO.File
any = TextBox1.Text
sr = prog.OpenText("thelist.txt")
While sr.Peek <> -1
str = sr.ReadLine
str2 = str.Substring(0, 4)
If any.ToLower = str2.ToLower Then
ListBox1.Items.Add(str)
End If
End While
End Sub