Customcontrol validating user input in
Let's check out the details of how to implement the validation rules.
Validation rules are very easy to implement since you only have to inherit from the validation Rule class as shown below: The code above validates the user input against the null and empty values.
That is done by setting Validation Type property as shown in image below: These properties allow you to define 3 level validation for each control.
Validation starts with Validator1, Validator2 and finally Validator3.
You can read more about regular expressions in MSDN starting at following URL: Regular Expression Validator is assigned to input field it looks like this in property grid: Super Validator component includes Comparison Validation that allows you to compare values of two input fields or to compare input field value to a predefined value you set.You can use this for example to ensure that password entered matches the confirmation password on input form or to ensure that numeric input value is greater than number you specify.Here is an example of input form that uses comparison validation to ensure that two password fields are the same: Next step is to attach event handler for Validate Value event on custom validator. NET property grid using the combo-box on top of the property grid: With Custom Validator component selected, switch to the event view: And double-click the Validate Value event to create event handler: Here is example code for Validate Value event handler: C# This example validation simply checks whether value entered is “Dot Net Bar” and validates control input if it is. Validating Event On Container At the bottom of this article you can find sample project that shows how to create simple Custom Validator from code.The User Control defined in the above code is a very simple control.It consists of a Dock Panel control which contains a Label control.