title: StreamReader - Reading from lines
body: <p>I have the following code;</p>
  
  <pre><code>Public Sub writetofile()
  
    ' 1: Append playername
      Using writer As StreamWriter = New StreamWriter("highscores.txt", True)
          writer.WriteLine(PlayerName)
      End Using
  
      ' 2: Append score
      Using writer As StreamWriter = New StreamWriter("highscores.txt", True)
          writer.WriteLine(Score)
      End Using
  
  End Sub
  </code></pre>
  
  <p>What I now want to do is read all the odd lines of the file (the player names) and the even lines into two separate list boxes, how would I go about that??</p>
  
  <p>I need to modify;</p>
  
  <pre><code>Using reader As StreamReader = New StreamReader("file.txt")
              ' Read one line from file
              line = reader.ReadLine
          End Using
  </code></pre>
  
  <p>I have used one of the following solutions but cannot get it working :(</p>
  
  <pre><code>Public Sub readfromfile()
      Using reader As New StreamReader("scores.txt", True)
          Dim line As Integer = 0
          While Not reader.EndOfStream
              If line Mod 2 = 0 Then
                  frmHighScores.lstScore.Items.Add(line)
              Else
                  frmHighScores.lstScore.Items.Add(line)
              End If
              line += 1
          End While
      End Using
  End Sub
  </code></pre>