PureSc0pe
03-11-04, 11:43 PM
I need a script that when you type something into the text box, and then hit search, it searches a text file and displays all of the results on a listbox. If there are no results, a message saying so would be nice too. I'm sure where to request or get help with scripts, so here I am....This is what I have so far, it doesn't do what I explained though.
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
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