Input for WinForms | ComponentOne
Data Validation / Pre-Validation
In This Topic
    Pre-Validation
    In This Topic

    PreValidation or (raw string validation) is the process of validating the input string entered by the user, before parsing. Input provides The PreValidation class that has the validation rules applied before converting the string entered by the user to the DataType.

    Input string validation is controlled by the PreValidation property in TextBox, ComboBox and NumericEditor. 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 ValidatingEvent option, you can perform input string validation in code, in the Validating 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.

    Examples

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