C datagridview cellvalidating cancel
I would prefer to to just pinpoint cell(s) with errors and ensure that the user can't continue until they are corrected. 'checking whether everything is correct 'if not an exeption is thrown Catch ex as Exception e. Private Sub Cell Validating(By Val sender as Object, By Val e as Data Grid View Cell Validating Event Args) Handles DGV. Cancel = True '(its totally working fine now - thanks for explanation) My. This almost gets me where I want to be, but the problem is if the user has some invalid data in the cell, the rest of the UI is essentially off-limits until they fix the error or press Esc.Since pressing Esc might not be intuitive to certain users, they may find it frustrating that they can't e.g.1) Add a conditional statement in the event handler code to only execute when required.2) Detach the event hander before the unwanted event triggers and re-attach after.I do like that they aren't allowed to start editing other cells without fixing errors in their current cell, but I'd prefer they still be able to press the "Back"/"Cancel" buttons on the form. @keyboard P That seemed to at least partially work, as now the Cancel button can be used with invalid data in a cell.
If you want to allow the user to do something else while the invalid value remains in the cell then I wouldn't use the Cell Validating event.
My problem is that the Row Validating event seems to fire BEFORE my button's click handler is fired, and at all.