单击工具栏保存按钮时,Datagridview接受当前编辑 [英] Datagridview Accept Current Edits when toolbar save button Clicked
问题描述
场景:
我有一个可编辑的数据网格视图和一个带有表单上的保存按钮的工具栏。
用户输入的是值进入单元格并单击保存按钮。
这会导致记录不保存键入的值,因为他们没有通过使用回车键或更改其选择来接受更改另一行。
有没有办法让保存按钮接受更改,就好像在保存按钮之前按下了输入按钮一样?
< blockquote>
尝试执行
dataGridView.EndEdit()。
当输入的数据无效时,请检查有关可能的例外和事件的文档。
Scenario:
I have a editable datagridview and a toolbar with a save button on the form.
Users are typing a value into the cell and clicking the save button.
This results in the record not saving the typed value as they have not accepted the change by using the enter Key or changing their selection to an alternative row.
Is there a way to have the save button accept the change as if the enter button was pressed prior to the save button?
Try executing dataGridView.EndEdit( ).
Check the documentation about the possible exceptions and events when the entered data are invalid.
这篇关于单击工具栏保存按钮时,Datagridview接受当前编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!