title: C# how to delete and update data without database
body: <p>I'm trying to delete the input data from datagridview. This can hide it after a action it appear again. </p>
  
  <p>I tried to use this </p>
  
  <pre><code>foreach (DataGridViewCell oneCell in table.SelectedCells)
      if(oneCell.Selected)
          table.Rows.RemoveAt(oneCell.RowIndex);
  
  
  private void displayData()
      {
          table.DataSource = null;
  
          DataTable data = new DataTable();
          data.Columns.Add("Serial Number");
          data.Columns.Add("Car Type");
          data.Columns.Add("Bin Location");
          data.Columns.Add("Park Duration");
          data.Columns.Add("Park Fees");
  
          for (int i = 0; i &lt; carInfoSize; i++)
          {
              if (!string.IsNullOrEmpty(carInfo[i, 0]) &amp;&amp; !carInfo[i, 0].Equals("0"))
              {
                  data.Rows.Add(carInfo[i, 0], carInfo[i, 1], carInfo[i, 2], carInfo[i, 3], carInfo[i, 4]);
              }
          }
  
          table.DataSource = data;
      }
  </code></pre>