title: How to read a specific part of a line in a text document in VB 2010?
body: <p>I'm trying to read a specific part of a text document which will allow me to allow the user into the program.</p>
  
  <p>The problem i'm having with the code is that it is able to complete the first if statement but no the second - it reads the username but not the password.</p>
  
  <pre><code>Dim usernames() As String = File.ReadAllLines(Dir$("Usernames.txt"))
  For RecordNumber = 0 To UBound(usernames)
      If Trim(Mid(usernames(RecordNumber), 1, 15)) = TextBox1.Text Then
          If Trim(Mid(usernames(RecordNumber), 15, 30)) = TextBox2.Text Then 
              MsgBox("Password is correct")
          End If
      End If
  Next RecordNumber
  </code></pre>
  
  <p>Any help is greatly appreciated.
  Thanks </p>