title: Loading multiple items from a text file to a ListView C#
body: <p>I am creating a shopping basket form using a windows form application with visual studio, I have a text file with some products in and when the user selects load I want to read the file and then put the data into a ListView but it only does the first item. </p>
  
  <p>Here is my code so far and my results:</p>
  
  <pre><code>private void LoadOrder_Click(object sender, EventArgs e)
      {
          Stream myStream = null;
          OpenFileDialog theDialog = new OpenFileDialog();
          theDialog.Title = "Open Text File";
          theDialog.Filter = "TXT files|*.txt";
          theDialog.InitialDirectory = @"C:\";
          if (theDialog.ShowDialog() == DialogResult.OK)
          {
              try
              {
                  if ((myStream = theDialog.OpenFile()) != null)
                  {
                      using (myStream)
                      {
                          System.IO.StreamReader sr = new System.IO.StreamReader(myStream);
                          string fileContent = sr.ReadToEnd();
                          string[] fileItems = fileContent.Split('|');
                          sr.Dispose();
  
                          ListViewItem lv = new ListViewItem();
                          lv.Text = fileItems[0].ToString();
                          lv.SubItems.Add(fileItems[1].ToString());
                          lv.SubItems.Add(fileItems[2].ToString());
                          basket.Items.Add(lv);
                      }
                  }
              }
              catch (Exception ex)
              {
                  MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
              }
          }
      }
  </code></pre>
  
  <p>Text file:</p>
  
  <pre><code>Banana|6|0.25
  Steak|2|1.75
  Chips|1|3
  Sweets|6|1.5
  </code></pre>
  
  <p>ListView after Load:</p>
  
  <p><a href="https://i.stack.imgur.com/afwNa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/afwNa.png" alt="enter image description here"></a></p>
  
  <p>If anyone can help or point me in the right direction it would be appreciated, thanks!</p>