为什么我绑定的DataGridView抛出"因为它会导致重入调用SetCurrentCellAddressCore功能&QUOT操作无效;错误? [英] Why is my bound DataGridView throwing an "Operation not valid because it results in a reentrant call to the SetCurrentCellAddressCore function" error?

查看:413
本文介绍了为什么我绑定的DataGridView抛出"因为它会导致重入调用SetCurrentCellAddressCore功能&QUOT操作无效;错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当绑定的DataGridView 控件绑定源,我得到我的应用程序出现以下错误:

When binding a DataGridView control to a binding source, I'm getting the following error in my application:

操作是无效的,因为它会导致重入调用SetCurrentCellAddressCore功能

Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function

的绑定源依赖于数据表中。而我在过滤了DataGridView中的记录。我使用了 dataGridView1_CellValueChanged()事件在那里我过滤的DataGridView。但是,当我从当前单元格删除的数据,出现此错误。

The binding source depends on the data table. And I'm filtering the records from the DataGridView. And I used the dataGridView1_CellValueChanged() event where I'm filtering the DataGridView. But when I was deleting the data from the current cell, this error occurs.

我怎样才能解决这个问题呢?

How can I resolve this problem?

推荐答案

唯一的例外是为了发生提出的的DataGridView 来prevent一个无限循环。这样做的原因通常是以下之一:

The exception is raised by the DataGridView in order to prevent an infinite loop from occurring. The cause of this is usually one of the following:

  • 更改活性细胞当正在对当前活动的细胞进行的操作
  • 开始,结束或取消编辑模式,而一个单元格编辑已经在建
  • 在任何其他操作,结果在活动单元格正在而的DataGridView 仍然使用它修改
  • Changing the active cell while an operation is being performed on the currently-active cell
  • Beginning, ending or cancelling edit mode while a cell edit is already in-progress
  • Any other operation that results in the active cell being changed while the DataGridView is still using it

有一个在你的处理程序 CellValueChanged 事件,并确保你没有做任何的上述处理程序中。

Have a look at your handler for the CellValueChanged event and make sure you are not doing any of the above within the handler.

这篇关于为什么我绑定的DataGridView抛出"因为它会导致重入调用SetCurrentCellAddressCore功能&QUOT操作无效;错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆