I have a winform with preloaded DataGridView over it...I want to remove rows from datagridview on selecting or highlighting the rows and clicking over the button...
Also want to clear all the columns....
Currently i used
foreach (DataGridViewRow dgvr in dataGridView2.Rows)
{
if (dgvr.Selected == true)
{
dataGridView2.Rows.Remove(dgvr);
}
}
but it is throwing an exception that "rows or not commited" or something....it would be appreciable if any one have any better suggestions....