title: Reading a new line from text file using StreamReader
body: <p>What I have stored in my file is values related to an account. (Just testing, not going to be used commercially). What I need is to draw the values for the username and password, by going through each new line, but .peek() doesn't seem to work for me. What am i doing wrong? My block looks as such :</p>
  
  <pre><code>        public string CheckAccount(string username, string password)
      {
          StreamReader sr;
          string filename = "H:\\AccountInfo.txt";
          string s;
          string result = "";
          sr = File.OpenText(filename);
          s = sr.ReadLine();
          string usernameFromText;
          string passwordFromText;
          while (sr.Peek() &gt;= 0)
          {
              usernameFromText = (s.Split(','))[0];
              passwordFromText = (s.Split(','))[2];
              if (username == usernameFromText &amp;&amp; password == passwordFromText)
              {
                  result = "Successfully Logged in!";
              }
              else if (username != usernameFromText || password != passwordFromText)
              {
                  result = "Your Username / Password is Invalid!";
              }
          }
          sr.Close();
  
          return result;
      }
  </code></pre>
  
  <p>My code doesn't read from the 2nd line onwards, it just hangs.</p>