lundi 21 mai 2018

Removing a row from data grid view

Hi I am trying to remove rows from data grid view on certain conditions. I am successfully deleted rows however this is only working on the 1st condition.

When cell 6 is "" it is removed however when cell 6 is Status it is not. Could you please help please, we the 2nd condition is being ignorned.

       for (int i = dgvAuthG.Rows.Count - 1; i >= 0; i--)
        {
            if ((dgvAuthG.Rows[i].Cells[6].Value == "") || (dgvAuthG.Rows[i].Cells[6].Value == "Status"))
            {
                dgvAuthG.Rows.Remove(dgvAuthG.Rows[i]);
            }
        }
        dgvAuthG.Refresh();

Aucun commentaire:

Enregistrer un commentaire