Question

I have task,in my datagridview if i delete one row, that row will change the back color not delete in database until operations(update or save) commited. How can do this.?

Was it helpful?

Solution

It is difficult to provide a complete answer due to lack of information and code in your question. You might need something like this.

private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
    e.Cancel = true;
    dataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.LightGreen;
}

Follow these links. I think they maybe useful for you to solve your issue.

UserDeletingRow event (fires when a row is about to get deleted)

DefaultCellStyle property (to change the BackColor of the CurrentRow)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top