Cancel CellValidating error in DataGridView, so can close form while invalid entry still present
-
If the user has typed an invalid entry, so that CellValidating raises an error, and they then decide to abandon the edit and want to click the Cancel button, the form won't close because the eror still exists. Error needs to be cleared first. I just can't work out a way to achieve that, short of teaching the user that if they click Cancel, and the form doesn't close, press Esc so text reverts to original and then click Cancel again. Not ideal. :)
-
If the user has typed an invalid entry, so that CellValidating raises an error, and they then decide to abandon the edit and want to click the Cancel button, the form won't close because the eror still exists. Error needs to be cleared first. I just can't work out a way to achieve that, short of teaching the user that if they click Cancel, and the form doesn't close, press Esc so text reverts to original and then click Cancel again. Not ideal. :)
I know it's pretty old but I faced the same problem and wanted to ask if you managed solve it or not? Even setting CausesValidation property of the close button doesn't work. What have you done to work around the issue? Thanks a lot.
-
I know it's pretty old but I faced the same problem and wanted to ask if you managed solve it or not? Even setting CausesValidation property of the close button doesn't work. What have you done to work around the issue? Thanks a lot.
As far as I can remember I didn't solve the problem. User must press Esc to cancel the edit before doing ANYTHING else. You notice no-one offered a solution.
-
As far as I can remember I didn't solve the problem. User must press Esc to cancel the edit before doing ANYTHING else. You notice no-one offered a solution.
Thanks for replying. I saw no one replied but thought you may have devised a work around. The behaviour isn't good. Close button is close button afterall. Anyways thanks for your time. Cheers!