When inputting data, the user can only replace a placeholder with a character that is of the same type as the one specified in the input mask. If the user enters an invalid character, the control rejects the character. The control can distinguish between numeric and alphabetic characters for validation, but cannot validate for valid content, such as the correct month or time of day.
The input mask can consist of the following characters:
Character |
Description |
: | 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. |
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. |
Literal | All other symbols are displayed as literals; that is, they appear as themselves. |
Note: Masking is always enabled for the UltraDateTimeEditor control. When the MaskInput property is not specifically set, a default mask is used.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinEditors Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.SetupMasking() End Sub Private Sub SetupMasking() ' Set the UltraDateTimeEditor to display the 2-digit representation of the year Me.UltraDateTimeEditor1.MaskInput = "mm/dd/yy" ' Set the UltraNumericEditor to display a thousands separator Me.UltraNumericEditor1.MaskInput = "n,nnn,nnn" ' Set the UltraCurrencyEditor to display a thousands separator, ' and no currency symbol Me.UltraCurrencyEditor1.MaskInput = "n,nnn.nn" ' Set the masking modes of the UltraDateTimeEditor to include literals, ' because the "/" character is part of the data in that it separates the ' components of the date (year, month, day) Me.UltraDateTimeEditor1.MaskDataMode = MaskMode.IncludeLiterals Me.UltraDateTimeEditor1.MaskClipMode = MaskMode.IncludeLiterals Me.UltraDateTimeEditor1.MaskDisplayMode = MaskMode.IncludeLiterals ' For the UltraNumericEditor and UltraCurrencyEditor, we don't ' want the thousands separator to be considered part of the data, ' so set the MaskDataMode to Raw. For the clipboard and display, ' however, we will display the literals. Me.UltraNumericEditor1.MaskDataMode = MaskMode.Raw Me.UltraNumericEditor1.MaskClipMode = MaskMode.IncludeLiterals Me.UltraNumericEditor1.MaskDisplayMode = MaskMode.IncludeLiterals Me.UltraCurrencyEditor1.MaskDataMode = MaskMode.Raw Me.UltraCurrencyEditor1.MaskClipMode = MaskMode.IncludeLiterals Me.UltraCurrencyEditor1.MaskDisplayMode = MaskMode.IncludeLiterals ' Set the PromptChar to the space character for all Me.UltraDateTimeEditor1.PromptChar = Chr(32) Me.UltraNumericEditor1.PromptChar = Chr(32) Me.UltraCurrencyEditor1.PromptChar = Chr(32) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; private void button1_Click(object sender, System.EventArgs e) { this.SetupMasking(); } private void SetupMasking() { // Set the UltraDateTimeEditor to display the 2-digit representation of the year this.ultraDateTimeEditor1.MaskInput = "mm/dd/yy"; // Set the UltraNumericEditor to display a thousands separator this.ultraNumericEditor1.MaskInput = "n,nnn,nnn"; // Set the UltraCurrencyEditor to display a thousands separator, // and no currency symbol this.ultraCurrencyEditor1.MaskInput = "n,nnn.nn"; // Set the masking modes of the UltraDateTimeEditor to include literals, // because the "/" character is part of the data in that it separates the // components of the date (year, month, day) this.ultraDateTimeEditor1.MaskDataMode = MaskMode.IncludeLiterals; this.ultraDateTimeEditor1.MaskClipMode = MaskMode.IncludeLiterals; this.ultraDateTimeEditor1.MaskDisplayMode = MaskMode.IncludeLiterals; // For the UltraNumericEditor and UltraCurrencyEditor, we don't // want the thousands separator to be considered part of the data, // so set the MaskDataMode to Raw. For the clipboard and display, // however, we will display the literals. this.ultraNumericEditor1.MaskDataMode = MaskMode.Raw; this.ultraNumericEditor1.MaskClipMode = MaskMode.IncludeLiterals; this.ultraNumericEditor1.MaskDisplayMode = MaskMode.IncludeLiterals; this.ultraCurrencyEditor1.MaskDataMode = MaskMode.Raw; this.ultraCurrencyEditor1.MaskClipMode = MaskMode.IncludeLiterals; this.ultraCurrencyEditor1.MaskDisplayMode = MaskMode.IncludeLiterals; // Set the PromptChar to the space character for all this.ultraDateTimeEditor1.PromptChar = ' '; this.ultraNumericEditor1.PromptChar = ' '; this.ultraCurrencyEditor1.PromptChar = ' '; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2