datagridview单元格编辑错误
在 Windows 窗体上,我有一个未绑定的 datagridview 和 1 个用户可编辑的列。用户单击其中一个单元格,改变主意并使用“x”关闭表单。然后他试图再次调出表格。出现以下错误:
“System.InvalidOperationException:操作未成功,因为程序无法提交或退出单元格值更改”
该错误实际上发生在我在通过 show.dialog 显示表单之前执行 datagridview.rows.clear 的情况。
我将 DataGridView.CancelEdit() 添加到 FormClosing 事件,但错误仍然存在。
我尝试注释掉 rows.clear 代码,但随后每行出现两次。 datagridview的数据源是一个集合。
感谢您的所有帮助。
On a Windows form I have an unbound datagridview with 1 user-editable column. A user clicked into one of those cells, changed his mind and closed the form using the "x". Then he tried to bring up the form again. The following error came up:
"System.InvalidOperationException: Operation did not succeed because the program cannot commit or quit a cell value change"
The error actually occurs where I do a datagridview.rows.clear before displaying the form via a show.dialog.
I added a DataGridView.CancelEdit() to the FormClosing event but the error remains.
I tried to comment out the rows.clear code but then each row appeared twice. The data source of the datagridview is a collection.
Thanks for all help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设置了表单的实例= Nothing,问题就消失了
I set the instance of the form = Nothing and the problem disappeared