title: How to add contents of a file to listview C#
body: <p>The file name is contacts.txt.
  Its contents are:</p>
  
  <pre><code>line 1: Adam
  line 2: adam@gmail.com
  line 3: Kris
  line 4: kris@gmail.com
  </code></pre>
  
  <p>I have a listview named <code>listview1</code>. It has 2 columns, <code>ColumnHeader1</code> &amp; <code>ColumnHeader2</code></p>
  
  <p>I want to add the name in the file to <code>ColumnHeader1</code> and email to <code>ColumnHeader2</code>, i.e, like:</p>
  
  <pre><code>Adam    adam@gmail.com
  Kris    kris@gmail.com
  </code></pre>
  
  <p>How do I do that?</p>
  
  <p>Also, I want this to happen automatically every time the form is loaded.</p>
  
  <p>Thank You in advance.</p>
  
  <p>Tried this.</p>
  
  <pre><code>using (StreamReader sr = new StreamReader(@"C:\Contacts.txt"))
  {
      while (sr.EndOfStream)
      {
          ListViewItem lvi = new ListViewItem(sr.ReadLine());
          lvi.SubItems.Add(sr.ReadLine());
          listView1.Items.Add(lvi);
          continue;
      }
      sr.Close();
  }
  </code></pre>