|
-
Dec 17th, 2019, 05:14 PM
#2
Re: Proper way to use Validating event
It's simple stuff. Handle the Validating event and set e.Cancel to True if validation fails to prevent the control losing focus. Before using the data, call ValidateChildren to ensure that even controls that haven't received focus are validated. Provide a Cancel Button and set its CausesValidation property to False so that clicking it will not cause the previous control to be validated. That allows you to close the form while it contains invalid data.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|