ComponentOne Input for WinForms
Using the C1Input Controls / Validating Data / Input String Validation (PreValidation)
In This Topic
    Input String Validation (PreValidation)
    In This Topic

    Input string validation is controlled by the PreValidation property. The PreValidation class allows you to specify validation rules either as wildcard pattern strings or regular expression strings. All rules (strings) are specified in the PatternString property. Multiple rules (sub-strings) are separated by the ItemSeparator ('|' by default).

    The PreValidation property defines how the PatternString is interpreted.

    Value Description
    ExactList PatternString contains a list of possible values separated by ItemSeparator.
    PreValidatingEvent The PreValidating event is being 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 PreValidation property.
    RegexPattern PatternString contains a regular expression.

    Using the PreValidatingEvent option, you can perform input string validation in code, in the PreValidating event. For more information, see the event description.

    If you use regular expressions, the RegexPattern option, there is also a RegexOptions property that is sometimes needed to set flags affecting regular expression functionality.

    Note: Input string validation (PreValidation) is not used in DateTimeInput and NumericInput modes. When DateTimeInput or NumericInput modes are active is Typed Value Validation (PostValidation) is performed.

    Examples

    The following examples describe how the Validation and PatternString properties are interpreted:

    See Also