D
Dan
I have a question about form data validation and error providers: typically,
I add some controls and an error provider to my form, then I handle the
Validating event of each control which requires validation and perform the
data check. In this handler I use the error provider SetError and set
e.Cancel to true when a validation error is found, so that the user has to
correct his input before leaving the control.
All this is fine, my question is: if there are many controls requiring
validation in the form, and the user just fills one and then clicks the OK
button without even entering the other controls, their Validating events are
*not* fired: to avoid the form closing with invalid data, I should then
re-check each control data in the OK button handler. How can I do this
without having to duplicate the validation code (once in the Validating
handler and another time in the OK button click handler)? I'd need some way
of triggering all the Validating events for each control in the form
requiring validation...
Thanx in advance!
I add some controls and an error provider to my form, then I handle the
Validating event of each control which requires validation and perform the
data check. In this handler I use the error provider SetError and set
e.Cancel to true when a validation error is found, so that the user has to
correct his input before leaving the control.
All this is fine, my question is: if there are many controls requiring
validation in the form, and the user just fills one and then clicks the OK
button without even entering the other controls, their Validating events are
*not* fired: to avoid the form closing with invalid data, I should then
re-check each control data in the OK button handler. How can I do this
without having to duplicate the validation code (once in the Validating
handler and another time in the OK button click handler)? I'd need some way
of triggering all the Validating events for each control in the form
requiring validation...
Thanx in advance!