单击任何其他单元格,同时datagridvew行的单元格处于编辑模式时,操作无效的可重入调用 [英] Click on any other cell while a cell of same row of datagridvew is in edit mode causes Operation is not valid reentrant call
问题描述
我的问题类似于下面,除了我不知道什么是替代方案。
My question is similar to below, except that i dont know whats the alternative.
为什么我绑定的DataGridView抛出操作无效,因为它的结果在对SetCurrentCellAddressCore功能的重入调用中错误?
当用户完成编辑时,datagridview应该刷新并显示只满足gird的dataview条件的记录。所以在EndEdit结尾我调用一个控件的doubleClick事件,再次根据条件填充网格。只要编辑完成,这种方法工作正常。但是如果用户仍然处于编辑模式&点击相同的 datagridview的任何其他单元格我得到这个例外。
When user finishes editing, the datagridview should refresh and display only those records which satisfy the gird's dataview criteria. so at the end of EndEdit i call doubleClick event of a control which populates the grid again according to the criteria. this approach works fine as long as the edit is complete. but if the user is still in edit mode & any other cell of the same datagridview is clicked i get this exception.
操作无效,因为它的结果在
SetCurrentCellAddressCore函数的可重入调用中。
Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
每个其他控件都很好,因为网格不在编辑模式。我试过:
every other control is good because grid is out of edit mode. I have tried:
datagridview.CancelEdit();
推荐答案
如果您使用
this.BeginInvoke(new MethodInvoker(Refresh_dataGridView1));
应该可以解决问题。更多详情 here
that should solve the problem. More details here
这篇关于单击任何其他单元格,同时datagridvew行的单元格处于编辑模式时,操作无效的可重入调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!