MaskedTextBox
Uses a mask to distinguish between proper and improper user input.
Last updated
Uses a mask to distinguish between proper and improper user input.
Last updated
The MaskedTextBox class is an enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input. Using the Mask property, you can specify the following input without writing any custom validation logic in your application:
Required input characters.
Optional input characters.
The type of input expected at a given position in the mask; for example, a digit, or an alphabetic or alphanumeric character.
Mask literals, or characters that should appear directly in the MaskedTextBox; for example, the hyphens (-) in a phone number, or the currency symbol in a price.
Special processing for input characters; for example, to convert alphabetic characters to uppercase.
The custom mask property editor allows user to select a value from a list of predefined masks. The predefined lists shows the most commonly used masks.
The InvalidMessage property gets or sets a tooltip message that is shown for an invalid entry.
Using the MaskedTextBox's TypeValidationCompleted event handler, any custom behavior can be defined for success or failure of the mask's validation.
The TextMaskFormat property determines how the literal and prompt characters in the mask are processed when the generating the formatted string. More specifically, it determines whether literal characters, prompt characters, or both are included in the Text property. When prompt characters are excluded, they are transformed into spaces in the formatted string.
ExcludePromptAndLiterals: Return only text input by the user.
IncludeLiterals: Return text input by the user as well as any literal characters defined in the mask.
IncludePrompt: Return text input by the user as well as any instances of the prompt character.
IncludePromptAndLiterals: Return text input by the user as well as any literal characters defined in the mask and any instances of the prompt character.
The color of the text in the MaskedTextBox control can be customized by setting the ForeColor property.
Class name
"wisej.web.MaskedTextBox"
Theme Appearance
"textbox"
Child components
"textfield" is the inner <input> widget. See JavaScript.
Toolcontainer state
"editor", see Embedded Tools.
Source code