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.
Its not permissible to have the two selected to true, but they can both be false. Error Text = "" Dim other Check As Boolean = False If (Datagrid1. Private Sub Datagrid1_Cell Validating(By Val sender As Object, By Val e As System.
Private Sub Datagrid1_Cell Validating(By Val sender As Object, By Val e As System.
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.
Can someone tell me / post some codes here on how could I validate my datagridview?
I mean, a certain column on my datagridview should accept integers only, otherwise, it will return a messagebox.
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 Once I'm in this process after the error text has been set, evn my close button, that has just a Me.close() in it does not work.