Cellvalidating cancel edit

When I reopen it I can see that the chages were not comitted to the database, which is fine.

I noticed that when I click on the checkbox to uncheck it after the e.cancel executed, that click does not change its value, I can both see in the UI that the value did not change before the cellvalidating event is called and in the cellvalidating event itself, when I set a breakpoint after the line that checks and verify the value of CBool(Datagrid1("Cell_2", e. The only way to close the form is to click on the form close cross in the upper right corner of the form.

If I then ckeck the second checbox (cell_2), it gives me the error message but does not return the second checkbox I checked to its unchecked state. Any help appreciated, Bob In a datagridview (vs2005, VB.net) I have two columns that are checkboxes. Its not permissible to have the two selected to true, but they can both be false.

Cancel = True End If End If End Sub Say I checked just one checkbox Cell_1 to start, the code allows the change to be made. I press the sacep key after the e,cancel and the message and I get the same problem. I need to check that only one of the two can be checked.

Its not permissible to have the two selected to true, but they can both be false.

cellvalidating cancel edit-34cellvalidating cancel edit-40cellvalidating cancel edit-9cellvalidating cancel edit-53

Perhaps it would be a good idea to post to the MSDN forums because I think some of the MS staff read those and can point you to the solution to this problem - given the similar symptoms I feel really sure the underlying cause must be similar or related, but it doesn't seem obvious to me how to implement the solution in this case. I know how frustrating it can be to have problems like this! I actually found a half-answer by taking the value of the current cell while it is editing and pushing it back to the dataset manually. scid=kb;en-us;833032 Geck0 I think we are going in the right direction! Anyway, I have had this exact problem and am 100% sure that if you look hard enough in the KB you can find the answer. David Edit: This is the page describing the problem / solution: I think common behaviour is so that the user can't leave the cell once validation fails and is forced to correct it before he can leave the cell. But there is a problem in your code, you can't use "Data Grid View[,]. I wrote code in the cellvalidating event as follows.

Leave a Reply