I have written a code in row_validating event which works fine.
now I want to clear this rows containing error in cells of datagridview.
I tried this code.
private void grdvEnergy_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
{
e.Cancel = true;
datagridview1.Rows[e.RowIndex].ErrorText = "Error message";
}
private void btnclear_Click(object sender, EventArgs e)
{
datagridview1.Rows.Clear();
}
But it gives me this error:
"Operation did not succeed because the program cannot commit or quit a cell value change."