title: Visual Basic split function
body: <p>Ok so now I'm not getting an error but instead of everything being posted in the listbox it only contains the first line of text from the .txt file. This is the code I changed it too:</p>
  
  <pre><code>Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  
      Dim inFile As IO.StreamReader
  
      If IO.File.Exists("StudentList.txt") = True Then
          inFile = IO.File.OpenText("StudentList.txt")
          For index As Integer = 0 To inFile.Peek = -1
              Dim splits = inFile.ReadLine.Split(","c)
              Member(index).ID = splits(0)
              Member(index).lastName = splits(1)
              Member(index).firstName = splits(2)
              Member(index).middleName = splits(3)
              Member(index).grade = splits(4)
              Member(index).period = splits(5)
  
              ListBox1.Items.Add(Member(index).ID.PadLeft(10) &amp; " " &amp; Member(index).lastName &amp; " " &amp; Member(index).firstName)
  
          Next
          inFile.Close()
      Else
          MessageBox.Show("error", "error", MessageBoxButtons.OK)
      End If
  
  End Sub
  </code></pre>