datagridview cell edit error
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
精彩评论