Version

InputMask Property (UltraMaskedEdit)

Returns or sets the input mask associated with the masked edit control.
Syntax
'Declaration
 
Public Property InputMask As String
public string InputMask {get; set;}
Remarks

When an input mask is defined, placeholders are defined by the PromptChar property. 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 and generates the InvalidChar event. 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

#

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. Character validation is performed by the char.IsLetterOrDigit() method.
a Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is not required. Character validation is performed by the char.IsLetterOrDigit() method.
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. Character validation is performed by the char.IsLetter() method.
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.
g or gg Era characters in a DateTime. 1 (g) or 2 (gg) letter abbreviation for the era in which the DateTime falls, in accordance with the control’s CultureInfo.
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.

Example
Following code sets some of the commonly used properties of UltraMaskedEdit in the Form's Load event

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinMaskedEdit

  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

      ' Set the InputMask to the desired mask.
      Me.ultraMaskedEdit1.InputMask = "mm/dd/yyyy"

      ' Set the DisplayMode, DataMode and ClipMode to desired values. DataMode dictates
      ' what the Text property (and Value property if the data is string type), returns.
      ' DisplayMode effects what gets displayed when the masked edit doesn't have focus.
      ' ClipMode effects what gets copied to the clipboard when the user copies text
      ' from the UltraMaskedEdit.
      Me.ultraMaskedEdit1.DataMode = MaskMode.IncludeLiterals
      Me.ultraMaskedEdit1.DisplayMode = MaskMode.IncludeLiterals
      Me.ultraMaskedEdit1.ClipMode = MaskMode.IncludeBoth

      ' If you want to show the spin buttons, set the SpinButtonDisplayStyle to either 
      ' OnRight or OnLeft. Spin buttons allow the user to conveniently increment or
      ' decrement a number section. It only works in numeric sections or date-time 
      ' sections.
      Me.ultraMaskedEdit1.SpinButtonDisplayStyle = SpinButtonDisplayStyle.OnRight

      ' You can also set the style of the spin buttons.
      Me.ultraMaskedEdit1.SpinButtonStyle = UIElementButtonStyle.PopupBorderless

      ' Set the border style to desired border style.
      Me.ultraMaskedEdit1.BorderStyle = UIElementBorderStyle.InsetSoft

      ' Set the DisplayStyle to desired display style. BorderStyle property settings
      ' will be ignored if you set the DisplayStyle to something other than Standard.
      Me.ultraMaskedEdit1.DisplayStyle = EmbeddableElementDisplayStyle.Standard

      ' Set the PromptChar to a desired character. Default is "_" (underscore character). 
      Me.ultraMaskedEdit1.PromptChar = "_"

      ' Set the PadChar to desired character. Default is " " (space character).
      Me.ultraMaskedEdit1.PadChar = " "

      ' You can set the padding in pixels around the text inside the masked edit.
      ' Default is 1.
      Me.ultraMaskedEdit1.Padding = 2

      ' Optionally assign an initialial value by setting the Value property.
      Me.ultraMaskedEdit1.Value = DateTime.Now

      ' Set the MinValue and MaxValues. The user input that doesn't satisfy these 
      ' min and max criteria is considered to be an invalid input and masked edit
      ' will fire MaskValidationError if the user tries to leave the control with
      ' such an input.
      Me.ultraMaskedEdit1.MinValue = New DateTime(1990, 1, 1)
      Me.ultraMaskedEdit1.MaxValue = New DateTime(2010, 12, 31)

	' The SpinWrap property gets/sets a value indicating whether the control's spin button
	' should wrap the value of a spinnable section. If true the spin button will wrap the
	' value incremented/decremented based on its Min/Max value.
	Me.ultraMaskedEdit1.SpinWrap = True

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinMaskedEdit;
using System.Diagnostics;

private void Form1_Load(object sender, System.EventArgs e)
{
	// Set the InputMask to the desired mask.
	this.ultraMaskedEdit1.InputMask = "mm/dd/yyyy";

	// Set the DisplayMode, DataMode and ClipMode to desired values. DataMode dictates
	// what the Text property (and Value property if the data is string type), returns.
	// DisplayMode effects what gets displayed when the masked edit doesn't have focus.
	// ClipMode effects what gets copied to the clipboard when the user copies text
	// from the UltraMaskedEdit.
	this.ultraMaskedEdit1.DataMode    = MaskMode.IncludeLiterals;
	this.ultraMaskedEdit1.DisplayMode = MaskMode.IncludeLiterals;
	this.ultraMaskedEdit1.ClipMode    = MaskMode.IncludeBoth;

	// If you want to show the spin buttons, set the SpinButtonDisplayStyle to either 
	// OnRight or OnLeft. Spin buttons allow the user to conveniently increment or
	// decrement a number section. It only works in numeric sections or date-time 
	// sections.
	this.ultraMaskedEdit1.SpinButtonDisplayStyle = SpinButtonDisplayStyle.OnRight;

	// You can also set the style of the spin buttons.
	this.ultraMaskedEdit1.SpinButtonStyle = UIElementButtonStyle.PopupBorderless;

	// Set the border style to desired border style.
	this.ultraMaskedEdit1.BorderStyle = UIElementBorderStyle.InsetSoft;

	// Set the DisplayStyle to desired display style. BorderStyle property settings
	// will be ignored if you set the DisplayStyle to something other than Standard.
	this.ultraMaskedEdit1.DisplayStyle = EmbeddableElementDisplayStyle.Standard;

	// Set the PromptChar to a desired character. Default is '_' (underscore character). 
	this.ultraMaskedEdit1.PromptChar = '_';
	
	// Set the PadChar to desired character. Default is ' ' (space character).
	this.ultraMaskedEdit1.PadChar = ' ';

	// You can set the padding in pixels around the text inside the masked edit.
	// Default is 1.
	this.ultraMaskedEdit1.Padding = 2;

	// Optionally assign an initialial value by setting the Value property.
	this.ultraMaskedEdit1.Value = DateTime.Now;

	// Set the MinValue and MaxValues. The user input that doesn't satisfy these 
	// min and max criteria is considered to be an invalid input and masked edit
	// will fire MaskValidationError if the user tries to leave the control with
	// such an input.
	this.ultraMaskedEdit1.MinValue = new DateTime( 1990, 1, 1 );
	this.ultraMaskedEdit1.MaxValue = new DateTime( 2010, 12, 31 );

      // The SpinWrap property gets/sets a value indicating whether the control's spin button
      // should wrap the value of a spinnable section. If true the spin button will wrap the
      // value incremented/decremented based on its Min/Max value.
       this.ultraMaskedEdit1.SpinWrap = true;
		
}
Requirements

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

See Also