Memento

Memento

  • NA
  • 111
  • 133.3k

c# winform - how to delete multiple DataGridViewRows

May 25 2012 12:08 AM
Here is m code:

foreach (DataGridViewRow r in dgv01.Rows)
        if (r.Cells[0].Value.ToString() == abc)
        {
        dgv01.Rows.Remove(r);
        //dgv01.CurrentCell = dgv01.Rows[0].Cells[0]; - also tried
        }

But only some rows are deleted - not all specified !?

Why - foreach - does not mean - foreach ?

Answers (2)