Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

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))
0
Murray Brown
Asked:
Murray Brown
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
Try calling DataGridView.EndEdit first.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi. I tried that and it caused the error to happen on all rows
0
 
Bob LearnedCommented:
Stupid DataGridView!!  What do you mean "all rows"?  Are you deleting more than 1 row?  Are you using a For Each?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
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
0
 
Bob LearnedCommented:
Try refreshing the DataGridView, and discarding the uncommitted row, instead of trying to delete it.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks Bob
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now