So before saving data, I want to validate whether all the required fields are filled (Text Boxes) by the user. I would rather use a generic function that would be passed each control on the form and based on the type of the control, separate validation logic would be written.
in case extra validation like restricting validation to some of the controls only, that would be decided at the function calling level.
This behavior was achieved by dragging an Error Provider component onto the dialog and handling the Validating event like so: Notice the call to Error Provider.
Set Error, passing in the control the error is associated with (which we get from the sender argument to the Validating event), along with the error string, which will be used as the tool tip.
Find the below sample screen shot for validating the fields before saving the data Img 3: Validation method Here I have validated the fields using the Boolean method, If all the field values are entered properly it will return true, other wise it will return false and will display an error message.Super Validator also provides validation based on the Regular Expressions.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.A network link to a server might fail just as you're transferring data.Or perhaps you simply didn't allow for a particular rare circumstance in your code. NET Framework offers a robust set of tools for dealing with these unexpected problems.