In This Topic
Pre-validation is raw string validation, which means that rules are applied before parsing.
DateEdit allows controlling pre-validation of input string through the PreValidation property. The control provides various pre-validation options, as follows:
- Case sensitive comparisons: Allows you to make string comparisons case sensitive. To enable case sensitive comparisons, set the CaseSensitive property to true.
- Validation pattern: Allows you to specify string containing the validation pattern or rules. To specify the validation pattern, set the PatternString property. Specify multiple rules or sub-strings by using an item separator in PatternString. DateEdit supports (| by default) as the item separator for multiple strings. However, to modify the item separator, set the ItemSeparator property.
-
Validation method: Allows you to specify the method of validation. To specify validation method, set the Validation property to any of the following values from PreValidationTypeEnum:
- ExactList: PatternString contains a list of possible values separated by ItemSeparator.
- PreValidatingEvent: PreValidating event is used in validation.
- Wildcards: PatternString contains a list of wildcard patterns separated by the ItemSeparator. The following characters are reserved in a pattern: ? (any single character), # (any single digit), * (zero or more characters), \ (escape). You can also define your own custom pattern characters using the pre-validation property.
- RegexPattern: PatternString contains a regular expression.
- Error message: Allows you to set the message that appears when input string does not match validation pattern. To set error message, set the ErrorMessage property.
The following image shows the DateEdit control displaying validation error message.
The following code snippet shows how to set various properties to apply pre-validation in DateEdit.