bboy_romeo
December 2nd, 2004, 12:27 PM
I've been trying to open a text file that i have created in windows notepad, to open up into a list box that i have created in a windows form. But im confused with the coding. If someone could possibly explain this to me in simple terms it would be great. Thanks.
DeepButi
December 3rd, 2004, 02:36 AM
bboy_romeo,
Dim file As IO.StreamReader
Dim MyStr as String
Dim filename As String ="YourFileNameHere.txt"
file = New IO.StreamReader(filename, System.Text.Encoding.Default)
MyStr = file.Readline()
While Not MyStr Is Nothing
ListBox1.Items.Add(MyStr)
MyStr = file.Readline()
End While
file.Close()
Hope it helps