2
Answers

c# winform - how to delete multiple DataGridViewRows

Memento

Memento

12y
1.7k
1
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)