提交datagridview更改 [英] Commit datagridview changes
本文介绍了提交datagridview更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在使用链接到DataSet的数据网格视图,并且可由用户编辑。
用户更改值并按下保存按钮,DataSet.HasChanges()返回false。
数据网格视图中修改后的行所做的更改尚未提交,但可以选择不同的行(通过按Enter或单击)。
但是用户往往忘记这样做,因此带来了问题;
如何强制datagridview提交对它的行进行任何更改?
Hello,
I'm working with a datagridview that is linked to a DataSet and is editable by the user.
When the user changes a value and presses the save button, DataSet.HasChanges() returns false.
The changes made in the modified row in the datagridview have not been committed though can be by selecting a different row (by pressing enter or clicking).
But users tend to forget doing so and therefor brings the question;
How can I force the datagridview to commit any changes made to it's rows?
推荐答案
有两个DatgridView属性可以帮助解决这个问题, IsCurrentCellDirty [ ^ ]和 IsCurrentRowDirty [ ^ ],如果有未提交的单元格则调用使用参数DataGridViewDataErrorContexts.Commit的CommitEdit。
另一种可能性是检查IsCurrentCellInEditMode并在单元格上调用EndEdit。
Alan。
Hi,
There are two DatgridView properties which should help solve this problem, IsCurrentCellDirty[^] and IsCurrentRowDirty[^], If there are uncommitted cells then call CommitEdit with the argument DataGridViewDataErrorContexts.Commit.
Another possibility is to examine IsCurrentCellInEditMode and call EndEdit on the cell.
Alan.
这篇关于提交datagridview更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文