开发者

datagridview cell edit error

开发者 https://www.devze.com 2022-12-26 23:13 出处:网络
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 th

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 fo开发者_如何学JAVArm 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.


I set the instance of the form = Nothing and the problem disappeared

0

精彩评论

暂无评论...
验证码 换一张
取 消