title: Deleting all the data from a datagridview
body: <p>Why doesn't this work?</p>
  
  <pre><code>    //::::::::::::::::::::::::::::::::::::
      private void uxClearButton_Click(object sender, EventArgs e)
      {
          clearDGV();
      }
      void clearDGV()
      {
          // remove selected rows 
          foreach (DataGridViewRow row in uxDGV.Rows)
          {
              uxDGV.Rows.Remove(row);
          } 
      }
      //:::::::::::::::::::::::::::::::::::
  </code></pre>
  
  <p>The DGV is not bound and the user has typed information into it.</p>
  
  <p>Error I get is <code>InvalidOperationException was unhandled  Uncommitted new row cannot be deleted.</code></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>ok - thanks to Steve etc for encouraging me to find the answer for myself!!</p>
  
  <pre><code>uxChargeBackDataGridView.Rows.Clear();
  </code></pre>