Hello guys.
I'am trying to make my search program, so that i can load a text file and search it.
I used this code for browsing and opening
Dim streamer As IO.StreamReader
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
streamer = IO.File.OpenText(TextBox1.Text)
Dim mystring() As String = streamer.ReadToEnd.Split(vbNewLine)
ListBox1.Items.AddRange(mystring)
End Sub
So this will browse for text file and when I open it, this text file should appear in listbox.
But when I click browse i get a dialog box. If I click cancel this error appears:
System.ArgumentException: Empty path name is not legal.
And one more question how to delete path of my text file. Because when I add it, path appears in textbox.