RestrictInputValidator Control
Description
RestrictInputValidator is a Validator to be used with my RestrictInputTextBox Control. As you may have noticed if you read the Remarks section of the RestrictInputTextBox page, the RestrictInputTextBox does not prevent the user from copying & pasting invalid characters into the RestrictInputTextBox. The RestrictInputValidator validates this as well. Also, as an extra convenience, if the RestrictInputValidator's ControlToValidate is a RestrictInputTextBox it automatically uses the same values for the Accepted, Specific, and Invalid attributes when doing the validation to insure that both the RestrictInputTextBox and RestrictInputValidator are checking for the same restrictions.
Example
ValidInput Enumeration Accepted Characters    
ValidInput.None
ValidInput.AllChars Any Character
ValidInput.Letters [A-Z],[a-z]
ValidInput.AlphaNumericDigits [A-Z],[a-z],[0-9]
ValidInput.AlphaNumericNumbers [A-Z],[a-z],[0-9],.,-
ValidInput.Uppercase [A-Z]
ValidInput.Lowercase [a-z]
ValidInput.Digits [0-9]
ValidInput.Integers [0-9],-
ValidInput.Numbers [0-9],.,-
ValidInput.PositiveNumbers [0-9],.
ValidInput.Hexadecimal [0-9],[A-F],[a-f]
ValidInput.Binary [0-1]
ValidInput.Octal [0-7]
Properties & Methods
RestrictInputValidatorThe RestrictInputValidator is used to validate the RestrictInputTextBox Control, as well as standard TextBoxes
  • Accepted - A member of the RestrictInputTextBox.ValidInput enumeration used to determine the predefined group of accepted characters. If the ControlToValidate property is a RestrictInputTextBox Control, the RestrictInputValidator will use the same value as the RestrictInputTextBox Control
  • Specific - A String containing any additional characters that you would like to add to the predefined characters in Accepted. If the ControlToValidate property is a RestrictInputTextBox Control, the RestrictInputValidator will use the same value as the RestrictInputTextBox Control
  • Invalid - A String containing any characters you would like to remove from the predefined characters in Accepted. If the ControlToValidate property is a RestrictInputTextBox Control, the RestrictInputValidator will use the same value as the RestrictInputTextBox Control
RestrictInputTextBox.ValidInput As ByteAn enumeration (defined in RestrictInputTextBox) used to specify a predefined group of accepted characters.
  • None - Accepts no characters. Although the validator will not allow any characters to be typed in the TextBox, Tab and Backspace may still be used for their standard purposes. This option is intended to be used only if you want to completely customize the list of accepted characters
  • AllChars - Accepts all characters other than newline and line terminators. Intended for use when there are only a few characters you do not want to allow
  • Letters - Accepts [A-Z],[a-z]
  • AlphaNumericDigits - Accepts [A-Z],[a-z],[0-9]
  • AlphaNumericNumbers - Accepts [A-Z],[a-z],[0-9],.,-
  • Uppercase - Accepts [A-Z]
  • Lowercase - Accepts [a-z]
  • Digits - Accepts [0-9]
  • Integers - Accepts [0-9],-
  • Numbers - Accepts [0-9],.,-
  • PositiveNumbers - Accepts [0-9],.
  • Hexadecimal - Accepts [0-9],[A-F],[a-f]
  • Binary - Accepts [0-1]
  • Octal - Accepts [0-7]
Source Code
RestrictInputValidator.vb:



RestrictInputValidator.js:

Remarks
The RestrictInputValidator uses the ValidInput enumeration from the RestrictInputTextBox Control. Therefore, in order to use the RestrictInputValidator you will need to download the RestrictInputTextBox Control as well. When using the RestrictInputValidator with MultiLine TextBoxes, be sure to remember that the newline character must be added using the Specific property.