جهت استفاده از امکانات MaskedTextBox
Mask characters
Character Description
0 Required digit (0-9).
9 Optional digit or space. If left blank, a space is inserted automatically.
# Optional digit, space, or plus/minus symbol. If left blank, a space is inserted automatically.
L Required ASCII letter (a-z or A-Z).
? Optional ASCII letter.
& Required Unicode character. Allows anything that isn't a control key, including punctuation and symbols.
C Optional Unicode character.
A Required alphanumeric character (allows letter or number but not punctuation or symbols).
a Optional alphanumeric character.
. Decimal placeholder.
, Thousands placeholder.
: Time separator.
/ Date separator.
$ Currency symbol.
< All the characters that follow will be converted automatically to lowercase as the user types them in. (There is no way to switch a subsequent portion of the text back to mixed-case entry mode once you use this character.)
> All the characters that follow will be converted automatically to uppercase as the user types them in.
\ Escapes a masked character, turning it into a literal. Thus, if you use \& it is interpreted as a literal character &, which will be inserted in the text box.
All other characters All other characters are treated as literals, and are shown in the text box.
بعضی از مهمترین خواص این کنترل :
BeepOnError
If the user inputs an invalid character and BeepOnError is TRue, the MaskedTextBox will play the standard error chime.
PromptChar
When the text box is empty, every required value is replaced with a prompt character. By default, the prompt character is the underscore (_), so a mask for a telephone number will display (_ _ _)-_ _ _-_ _ _ _ while empty.
MaskCompleted
Returns TRue if there are no empty characters in the text box (meaning the user has entered the required value).
InputText
InputText returns the data in the MaskedTextBox without any literal characters. For example, in a MaskedTextBox that allows the user to enter a telephone number, the Text property will return the fully formatted number, like (123)-456-7890, while InputText returns just the numeric content, or 1234567890.