EDN Admin
Well-known member
Hi,
I would like to delete empty row from a DataGridView after this row is commited. Here is my code.
<br/>
private void dgv_RowValidated(object sender, DataGridViewCellEventArgs e)<br/>
{<br/>
DataGridView oSender = ((DataGridView)sender);<br/>
<br/>
if (!oSender.Rows[e.RowIndex].IsNewRow)<br/>
{<br/>
if (IsEmptyRow(oSender.Rows[e.RowIndex]))<br/>
{ <br/>
oSender.Rows.RemoveAt(e.RowIndex);<br/>
}<br/>
}<br/>
}
I dont understand why I cant do it because I have an Exception: Operation cannot be performed in this event handler.
Can anybody help?
Thanks.
View the full article
I would like to delete empty row from a DataGridView after this row is commited. Here is my code.
<br/>
private void dgv_RowValidated(object sender, DataGridViewCellEventArgs e)<br/>
{<br/>
DataGridView oSender = ((DataGridView)sender);<br/>
<br/>
if (!oSender.Rows[e.RowIndex].IsNewRow)<br/>
{<br/>
if (IsEmptyRow(oSender.Rows[e.RowIndex]))<br/>
{ <br/>
oSender.Rows.RemoveAt(e.RowIndex);<br/>
}<br/>
}<br/>
}
I dont understand why I cant do it because I have an Exception: Operation cannot be performed in this event handler.
Can anybody help?
Thanks.
View the full article