Note: A parameterless constructor is required for all derived classes.
Use this method to retrieve the actual values that are being used to format the control. This method returns a value for all Appearance properties or only for specified ones, tracing up the Appearance hierarchy if necessary. You can combine the bit flags for this method to specify which properties should be resolved.
There may be times when you need to work with the text of an object in a particular format, but do not wish to change the settings of any of the masking properties (
GetText returns a string value, containing the text of the object, in the format you specify. When you invoke the GetText method, you pass it a maskmode parameter that determines how the object's text will be returned. This gives you the ability to bypass the settings of the object's masking properties and determine on an ad hoc basis whether to use prompt characters, literals or just the raw text the user has entered.
Invoke this method to simulate an action the user can perform.
Many actions are only appropriate in certain situations; if an action is inappropriate, it will not be performed.
You can use the
See
When you invoke this method, the control tries to delete the currently selected text and shift characters. If nothing is selected, it tries to delete the character at the current input position.
This method returns True if the operation was successful. If the operation fails because characters after the selection could not be shifted, the method returns False.
Invoke this method to reset the
Once this method is invoked, the
Returns a Boolean value that determines whether the
Returns True if the
Invoke the
Event that is fired when user performs an action that can not be executed because the state of the control (caret position, selection and other properties) does not allow it. For example, when the user presses left arrow key when caret is already at the first display character in the MaskedEdit, the left arrow key action (which is to move the caret to previous display character) can not be performed. In this case such an action is cosidered an invalid operation and this event is fired.
BackColor, ForeColor and BackGroundImage properties are
not supported. Use the
BackColor, ForeColor and BackGroundImage properties are
not supported. Use the
BackColor, ForeColor and BackGroundImage properties are
not supported. Use the
The Fontproperty is not supported. Use the
Appearance property lets you specify appearance related attributes, things
like the background color, foreground color, font, text alignments etc...
See
This property controls the look of the spin buttons. To enable spin buttons functionality,
set the
If true the spin button will wrap the value incremented/decremented based on its Min/Max value.
You can use the
When this property is set to one of the pre-defined mask types, the input mask is set to appropriate string. Pre-defined mask types include Currency, Date, Time, Date/Time, Double, Integer and String.
If this property is set to AutoSense, an input mask will be derived from the type of the data field bound to the control. If this property is set to UseSpecifiedMask, the mask specified by the
Note that if the
Note that this propery needs to be set on UltraMaskedEdit if
The UltraMaskedEdit event manager gives you a high degree of control over how the control invokes event procedures. You can use it to selectively enable and disable event procedures depending on the context of your application. You can also use the event manager to return information about the state of the control's events.
The event manager's methods are used to determine the enabled state of an event (
When an input mask is defined, placeholders are defined by the
The input mask can consist of the following characters:
Character | Description |
# | Digit placeholder. Character must be numeric (0-9) and entry is required. |
. | Decimal placeholder. The actual character used is the one specified as the decimal placeholder by the system's international settings. This character is treated as a literal for masking purposes. |
, | Thousands separator. The actual character used is the one specified as the thousands separator by the system's international settings. This character is treated as a literal for masking purposes. |
| : | Time separator. The actual character used is the one specified as the time separator by the system's international settings. This character is treated as a literal for masking purposes |
| / | Date separator. The actual character used is the one specified as the date separator by the system's international settings. This character is treated as a literal for masking purposes. |
| \ | Treat the next character in the mask string as a literal. This allows you to include the '#', '&', 'A', and '?' as well as other characters with special meanings in the mask. This character is treated as a literal for masking purposes. |
| & | Character placeholder. Valid values for this placeholder are ANSI characters in the following ranges: 32-126 and 128-255 (keyboard and foreign symbol characters). |
| > | Convert all the characters that follow to uppercase. |
| < | Convert all the characters that follow to lowercase. |
| A | Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is required. |
| a | Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is not required. |
| 9 | Digit placeholder. Character must be numeric (0-9) but entry is not required. |
| - | Minus sign when followed by a number section defined by series of 'n's (like in "-nn,nnn.nn") indicates that negative numbers are allowed. When not followed by a series of 'n's, it's taken as a literal. Minus sign will only be shown when the number is actually negative. |
| + | Plus sign when followed by a number section defined by series of 'n's (like in "-nn,nnn.nn") indicates that negative numbers are allowed. However, it differs from '-' in the respect that it will always show a '+' or a '-' sign depending on whether the number is positive or negative. |
| C | Character or space placeholder. Character entry is not required. This operates exactly like the '&' placeholder, and ensures compatibility with Microsoft Access. |
| ? | Letter placeholder. For example: a-z or A-Z. Character entry is not required. |
| n | Digit placeholder. A group of n's can be used to create a numeric section where numbers are entered from right to left. Character must be numeric (0-9) but entry is not required. |
| mm, dd, yy | Combination of these three special tokens can be used to define a date mask. mm for month, dd for day, yy for two digit year and yyyy for four digit year. Examples: mm/dd/yyyy, yyyy/mm/dd, mm/yy. |
| hh, mm, ss, tt | Combination of these three special tokens can be used to define a time mask. hh for hour, mm for minute, ss for second, and tt for AP/PM. Examples: hh:mm, hh:mm tt, hh:mm:ss. |
| {date} | {date} token is a place holder for short date input. The date mask is derived using the underlying culture settings. |
| {time} | {time} token is a place holder for short time input. Short time typically does not include the seconds portion. The time mask is derived using the underlying culture settings. |
| {longtime} | {longtime} token is a place holder for long time input. Long time typically includes the seconds portion. The long time mask is derived using the underlying culture settings. |
| {double:i.f:c} | {double:i.f:c} is a place holder for a mask that allows floating point input where i and f in i.f specify the number of digits in the integer and fraction portions respectively. The :c portion of the mask is optional and it specifies that the inputting of the value should be done continous across fraction and integer portions. For example, with :c in the mask, in order to enter 12.34 the user types in "1234". Notice that the decimal separator character is missing. This allevietes the user from having to type in the decimal separator. |
| {double:-i.f:c} | Same as {double:i.f:c} except this allows negative numbers. |
| {currency:i.f:c} | Same as {double:i.f:c} except the mask is constructed based on currency formatting information of the underlying format provider or the culture. It typically has the currency symbol and also displays the group characters. |
| {currency:-i.f:c} | Same as {currency:i.f:c} except this allows negative numbers. |
| Literal | All other symbols are displayed as literals; that is, they appear as themselves. |
You can also escape the mask with {LOC} character sequence to indicate that symbols in the following table should be mapped to the associated symbols in the underlying culture settings.
Character | Description |
| $ | Currency symbol. |
| / | Date seperator. |
| : | Time seperator. |
| , | Thousands seperator. |
| . | Decimal seperator. |
| + | Positive sign. |
| - | Negative sign. |
FormatString property is used to specify the format with which to format the
value for displaying purposes when the control doesn't have focus. When the control
has focus,
Use this property for binding puproses.
If Nullable is true and user has not input any text, this property will return DBNull. If Nullable is false and user has not input any text, masked edit will consider it an invalid input.
When EditAs property is set to AutoSense and no InputMask is specified, and this property is set to an object of supported type, masked edit will automatically use an appropriate default mask for that type. If an object of type that is not supported by the masked edit is assigned, it will throw an ArgumentException.
The pad character is the character that is used to replace the prompt characters when getting the data from the Masked Edit control with DataMode.
This property is used to determine how mask literals and prompt characters are displayed when the control is not in edit mode. Based on the setting of this property, the text of the control will contain no prompt characters or literals (just the raw data), the data and just the literals, the data and just the prompt characters, or all the text including both prompt characters and literals. The formatted spacing of partially masked values can be preserved by indicating to include literals with padding, which includes data and literal characters, but replaces prompt characters with pad characters (usually spaces).
Generally, prompt characters disappear when a cell is no longer in edit mode, as a visual cue to the user. In some cases, however, it may be appropriate in your application to display mask literals as well as data when a cell is no longer in edit mode.
This property is used to determine how mask literals and prompt characters are handled when the control's contents are passed to the data source (or are retrieved using the
Generally, simply the raw data is committed to the data source and data masking is used to format the data when it is displayed. In some cases, however, it may be appropriate in your application to store mask literals as well as data.
This property is used to determine how mask literals and prompt characters are handled when the control's contents are copied to the clipboard. Based on the setting of this property, the text of the control will contain no prompt characters or literals (just the raw data), the data and just the literals, the data and just the prompt characters, or all the text including both prompt characters and literals. The formatted spacing of partially masked values can be preserved by indicating to include literals with padding, which includes data and literal characters, but replaces prompt characters with pad characters (usually spaces).
The KeyActionMappings property provides access to the control's mechanism for handling keyboard input from users. All keystrokes for actions such as selection, navigation and editing are stored in a table-based system that you can examine and modify using this property. Through the KeyActionsMappings property, you can customize the keyboard layout of the control to match your own standards for application interactivity.
For example, if you wanted users to be able to navigate between cells by pressing the F8 key, you could add this behavior. You can specify the key code and any special modifier keys associated with an action, as well as determine whether a key mapping applies in a given context.
The following table lists the default key mappings for the
| KeyCode | ActionCode | StateRequired | StateDisallowed | SpecialKeysRequired | SpecialKeysDisallowed |
|---|---|---|---|---|---|
| Right | NextCharacter | Character | Ctrl | ||
| Right | NextSection | Character | LastSection | Ctrl | |
| Right | AfterLastCharacter | LastSection | Ctrl | ||
| Right | SetPivot | UnInitialized | Shift | ||
| Left | PrevCharacter | FirstCharacter | Ctrl | ||
| Left | PrevSection | FirstSection | Ctrl | ||
| Left | FirstCharacter | FirstSection | FirstCharacter | Ctrl | |
| Left | SetPivot | UnInitialized | Shift | ||
| Home | FirstCharacter | FirstCharacter | |||
| Home | SetPivot | UnInitialized | Shift | ||
| End | AfterLastCharacter | AfterLastCharacter | |||
| End | SetPivot | UnInitialized | Shift | ||
| Tab | NextSection | Character, TabBySections | LastSection | Shift | |
| Tab | SetPivot | Character, TabBySections | LastSection | Shift | |
| Tab | SelectSection | Character, TabBySections | LastSection | Shift | |
| Tab | PrevSection | TabBySections | FirstSection | Shift | |
| Tab | SetPivot | TabBySections | FirstSection | Shift | |
| Tab | SelectSection | TabBySections | FirstSection | Shift | |
| Delete | Delete | Selected | Shift | ||
| Delete | Delete | Character | Selected | Shift | |
| Delete | Backspace | Selected | Shift | Ctrl | |
| Delete | AfterLastCharacter | Character | Selected | Ctrl | Shift |
| Delete | Delete | Character | Selected | Ctrl | Shift |
| Back | Backspace | Selected | |||
| Back | Backspace | FirstCharacter, Selected | |||
| C | Copy | Selected | Ctrl | ||
| X | Cut | Selected | Ctrl | ||
| V | Paste | Ctrl | |||
| Insert | ToggleInsertionMode | ShiftCtrl | |||
| Up | UpKeyAction | UnInitialized | |||
| Down | DownKeyAction | UnInitialized | |||
| Insert | Copy | Selected | UnInitialized | Ctrl | Shift |
| Insert | Paste | UnInitialized | Shift | Ctrl | |
| Delete | Cut | Selected | UnInitialized | Shift | Ctrl |
When this property is set to True, characters typed will be inserted at the current text caret position and any following characters will be moved. When set to false, typing at an insertion point that contains an existing character will replace that character. The value of this flag also affects how characters are deleted using either The Delete key or the Backspace key. When in insert mode, characters after the character being deleted will be shifted by one to the left within the section.
If the mask has been initialized, display characters are present and input can be processed.
If this property is set to True, the height of the control automatically adjusts when the font is changed. When False, the control's height remains the same until explicitly changed. The default is True.
Indicates whether the control can utilize an
When this property is set to SelectEnteredCharacters, the select-all-text operation will select text starting from the first entered character to the last entered character, including adjacent literals.