title: Import a CSV file to my datagridview
body: <p>I am working on a project where I have to import a CSV file, and display the results in a DataGridView. I am struggling to display my data fields to my datagridview, I want to be able add each row at a time so it parses them correctly. Here is my code so far. </p>
  
  <pre><code>   csv.MissingFieldAction = MissingFieldAction.ReplaceByNull;
     int fieldCount = csv.FieldCount;
     string[] headers = csv.GetFieldHeaders();
     fieldCount = fieldCount - 1;
  
     //TO DO: Reading Header Information 
  
     for (int i = 0; i &lt;= fieldCount; i++)
     {
         DataGridViewTextBoxColumn headerRow = new DataGridViewTextBoxColumn();
         headerRow.Name = headers[i];
         headerRow.HeaderText = headers[i];
         headerRow.Width = 100;
         dgvComplianceImport.Columns.Add(headerRow);
     }
  
  
     while (csv.ReadNextRecord())
     {
         //for (int i = 0; i &lt; fieldCount; i++)
         //    string.Format("{0} = {1};",
         //                    headers[i],
         //                    csv[i] == null ? "MISSING" : csv[i]);
  
  
  
         //TO DO: for loop to add each data field row
  
         DataGridViewRow dgvr = new DataGridViewRow();
         for (int fieldCount = 0; fieldCount &lt;= csv.FieldCount; fieldCount++)
         {
             string field = csv[fieldCount];
  
  
         }
         dgvr.Cells.Add(new DataGridViewCell());
         dgvComplianceImport.Rows.Add(dgvr);
     }
  
     dgvComplianceImport.DataSource = csv;
  
  }
  </code></pre>