The following text file search only half works. Here is an example of something I would be searching: Alex:12.34.56.78 When I search by Alex, it displays the results. However if I search by 12.34.56.78, it says No Results Found. Why is it only working when I search by the name and not when I search by the numbers as well? Please Help.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim str, any, str2 As String
Dim sr As System.IO.StreamReader
Dim prog As System.IO.File
any = TextBox1.Text
sr = prog.OpenText(TextBox2.Text)
While sr.Peek <> -1
str = sr.ReadLine
str2 = str.Substring(0, TextBox1.Text.Length)
If any.ToLower = str2.ToLower Then
ListBox1.Items.Add(str)
End If
End While
If ListBox1.Items.Count = 0 Then
MessageBox.Show("No Results Found", "Program V 1.0",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim str, any, str2 As String
Dim sr As System.IO.StreamReader
Dim prog As System.IO.File
any = TextBox1.Text
sr = prog.OpenText(TextBox2.Text)
While sr.Peek <> -1
str = sr.ReadLine
str2 = str.Substring(0, TextBox1.Text.Length)
If any.ToLower = str2.ToLower Then
ListBox1.Items.Add(str)
End If
End While
If ListBox1.Items.Count = 0 Then
MessageBox.Show("No Results Found", "Program V 1.0",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub