I've an editable unbounded datagridview. I'm changing the value of new row programmatically.
Normally, when user types in any field of a new row, it becomes dirty and another new row is inserted below it.
But in my case, when user comes in to any field of a new row, I'm trapping the function key and changing the cell value programmatically.
myGrid.CurrentCell.Value = "xyz";
And it doesn't insert a new row below it.
Now as a work around I tried this on CellValueChanged event handler.
if (myGrid.NewRowIndex == e.RowIndex)
{
myGrid.Rows.Insert(e.RowIndex + 1, 1);
}
But it throws error saying No row can be inserted after the uncommitted new row.
.
How could I tell myGrid that I've made current row (which is a new row) dirty and that there is need of a new row after it?
Here I got the solution
myGrid.NotifyCurrentCellDirty(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With