title: How to remove rows from DataGridView?
body: <p>I have a winform with preloaded DataGridView over it...I want to remove rows from datagridview on selecting or highlighting the rows and clicking over the button...</p>
  
  <p>Also want to clear all the columns....</p>
  
  <p>Currently i used </p>
  
  <pre><code>foreach (DataGridViewRow dgvr in dataGridView2.Rows)
  {
      if (dgvr.Selected == true)
      {
          dataGridView2.Rows.Remove(dgvr);
      }
  }
  </code></pre>
  
  <p>but it is throwing an exception that "rows or not commited" or something....it would be appreciable if any one have any better suggestions....</p>