Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net DataGridView Uncommitted row cannot be deleted

Hi. I am using the following code to delete rows in an unbound DataGridView
It works for any row except where the DGV_RowIndex is zero
where I get the error "Uncommitted row cannot be deleted"

Me.DGV_Joins.Rows.Remove(Me.DGV_Joins.Rows(DGV_RowIndex))
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Try calling DataGridView.EndEdit first.
Avatar of Murray Brown

ASKER

Hi. I tried that and it caused the error to happen on all rows
Stupid DataGridView!!  What do you mean "all rows"?  Are you deleting more than 1 row?  Are you using a For Each?
Hi. I tried one row at a time. Previously the error just happened on the first row but now if I try and delete any other row I get the error
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Bob