title: CSV to ListView
body: <p>I'm trying to export my CSV file to ListView.</p>
  
  <p>ListView looks like this:</p>
  
  <p><a href="http://screenshooter.net/7827870/vrwwokd" rel="nofollow">http://screenshooter.net/7827870/vrwwokd</a></p>
  
  <p>I managed to export csv file but it puts everything in "Name" column.</p>
  
  <pre><code>private void toolStripButton1_Click(object sender, EventArgs e)
  {
  
  
      using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
          try
          {
              openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
              openFileDialog1.DefaultExt = "csv";
              openFileDialog1.Title = "Open file";
              openFileDialog1.Filter = "CSV (*.csv)|*.csv";
              if (openFileDialog1.ShowDialog() == DialogResult.OK)
              {
                  FileStream srcFS;
                  srcFS = new FileStream(openFileDialog1.FileName, FileMode.Open);
                  StreamReader srcSR = new StreamReader(srcFS,System.Text.Encoding.Default);
                  do
                  {
                    string ins = srcSR.ReadLine();
  
                    ListViewItem lvi = new ListViewItem();
                    lvi.SubItems.Add(ins);
  
                    if (ins != null) listView1.Items.Add(lvi);
                    else break;
                  } while (true);
                  srcSR.Close();
              }
          }
          catch (Exception errorMsg)
          {
              MessageBox.Show(errorMsg.Message,"Error reading a file",MessageBoxButtons.OK,MessageBoxIcon.Error);
          }
  
  } 
  </code></pre>
  
  <p>Anyone has a clue ? :)</p>
  
  <p>Here how it looks now:</p>
  
  <pre><code>        using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
      try
      {
          openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
          openFileDialog1.DefaultExt = "csv";
          openFileDialog1.Title = "Open file";
          openFileDialog1.Filter = "CSV (*.csv)|*.csv";
          if (openFileDialog1.ShowDialog() == DialogResult.OK)
          {
              FileStream srcFS;
              srcFS = new FileStream(openFileDialog1.FileName, FileMode.Open);
              StreamReader srcSR = new StreamReader(srcFS,System.Text.Encoding.Default);
              do
              {
                string ins = srcSR.ReadLine();
                string[] columns = ins.Split(',');
  
                ListViewItem lvi = new ListViewItem(columns[0]);
  
                lvi.SubItems.Add(ins);
  
                for (int i = 1; i &lt; columns.Count(); i++)
                {
                    lvi.SubItems.Add(columns[i]);
                }
  
                listView1.Items.Add(lvi);
  
              } while (true);
              srcSR.Close();
          }
      }
      catch (Exception errorMsg)
      {
          MessageBox.Show(errorMsg.Message,"Error reading a file",MessageBoxButtons.OK,MessageBoxIcon.Error);
      }
  </code></pre>