November 14th, 2011, 11:00 AM
How do I read a text file into an array?
I would like to read in a text file which contains a number of integers (one per line) and place these into an array. So far I have only been able to read them into a textbox like so:
Instead of spitting the values into a textbox I want them stored in an array. How would I do this?
Dim path As String = "C:\example.txt"
Dim sReader As New System.IO.StreamReader(path)
Dim textline As String
Do While sReader.Peek() <> -1
textline = textline & sReader.ReadLine() & vbNewLine
TextBox1.Text = textline