So I'm trying to populate an array from a text file. I'm in Visual Basic (which I haven't touched in over a year, and have very limited knowledge from a High School course.) I have the text being read and I attempted to put it into an array from various other resources online, except that the array isn't really being read. The last value in the text file is the value that's being stored, and I'm not really sure how to fix it. Here is the code I have so far:
Dim sr As New StreamReader("text file location")
Dim words(292) As String
Dim text as String = ""
Dim i As Integer = 0
Do Until sr.Peek = -1
text = sr.ReadLine()
words(i) = text
lstWords.Items.Add(words(i))
Loop
I'm new to the StackOverFlow community, and would love some help from anyone who is able to give it! Thank you in advance!