New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms ValidationProvider

This article will give you getting started experience with RadValidationProvider without using any code.

The TelerikMetro theme is used for the screenshots in this article.

  1. To start using RadValidationProvider just drag it from the toolbox and drop it onto the form:

    WinForms RadValidationProvider Drag from Toolbox

  2. Drag one RadTextBox and two RadDateTimePicker controls from the toolbox.

    WinForms RadValidationProvider Drag Two Controls

  3. Open the FilterDescriptor Collection Editor by clicking the Edit Validation Rules option in the Smart tag.

    WinForms RadValidationProvider Edit Validation Rules

  4. Add a RadValidationRule:

    WinForms RadValidationProvider Add RadValidationRule

  5. Select RadTextBox from the Controls drop down list:

    WinForms RadValidationProvider Select RadTextBox

  6. Select the Operator to be IsNotLike, leave the PropertyName to be Text and specify the ToolTipText:

    WinForms RadValidationProvider Adjust Rule

    The data type of the Value can be specified after entering a value first and then selecting the type from the drop down.

    As of R3 2020 RadValidationProvider supports nested PropertyNames to validate, e.g. Text.Length.

  7. If you start the application now, focus the RadTextBox control, leave it empty and try to navigate to another control, the validation will fail. It would be necessary to enter some text before proceeding further:

    WinForms RadValidationProvider Validation Fails

  8. Add a second validation rule. But this time add a RadValidationRuleWithTargetControl:

    WinForms RadValidationProvider RadValidationRuleWithTargetControl

  9. In the Controls drop down list, select radDateTimePicker1. In the TargetControl drop down list, select radDateTimePicker2. Set the Operator to IsLessThan. Specify the PropertyName and TargetControlPropertyName to Value and what ToolTipText to be displayed when the validation failed.

    WinForms RadValidationProvider TargetControl

  10. This rule will ensure that the first RadDateTimePicker's value is less than the value of the second one:

    WinForms RadValidationProvider Ensure Validation

In a similar way you can add a rule to validate that the second RadDateTimePicker's value is greater than the value of the first one.

See Also

Telerik UI for WinForms Learning Resources

In this article