删除Datagridview中的未提交行 [英] To delete an uncommitted row in Datagridview
问题描述
我在VB.Net项目中使用DatagridView。这里的数据只能在用户通过单独的按钮确认后提交。虽然用户可以删除添加的行,直到那个时间。我试图通过以下代码使删除的行不可见:
Hi,
I''m using DatagridView in my VB.Net Project. Here the data can only be committed after users confirmation via a separate button. Though the user can delete the added rows till that time. I''m trying to make deleted rows invisible by following code:
DataGridView1.Rows(selectedIndex).Visible = False
但是,遇到以下运行时错误:
系统。 InvalidOperationException:未提交的新行不能隐藏
请帮助解决错误或提出另一种方法来达到要求。
提前致谢 - *
However, getting following runtime error:
System.InvalidOperationException: "Uncommitted new row cannot be made invisible"
Please help in resolving the error or suggest an alternative to achieve the requirement.
Thanks in advance-*
推荐答案
不要将更改提交回数据库。刷新你绑定网格的数据集和whalla!没有更多未经审查的记录。
Don''t commit the changes back to the database. Refresh the data set you''ve bound the grid to and whalla! No more uncommited records.
这篇关于删除Datagridview中的未提交行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!