This documentation is archived and is not being maintained.

MaskedTextBox.SkipLiterals Property

Gets or sets a value indicating whether the user is allowed to reenter literal values.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public bool SkipLiterals { get; set; }
/** @property */
public boolean get_SkipLiterals ()

/** @property */
public void set_SkipLiterals (boolean value)

public function get SkipLiterals () : boolean

public function set SkipLiterals (value : boolean)

Not applicable.

Property Value

true to allow literals to be reentered; otherwise, false to prevent the user from overwriting literal characters. The default is true.

Input masks commonly contain literals. When the user enters characters into the MaskedTextBox at runtime, the current character position will sometimes fall on a literal. The SkipLiterals property describes how user input for the next character is to be handled, as follows:

  • If this property is true, the user can either redundantly enter the same character as the literal at the current position, or can enter the next editable character, thereby jumping the current position to that position.

  • If this property is false, the user can only enter the next editable character. If the next position in the mask will not accept the literal character (for example, the user types "/" and the next position only accepts digits), the control will raise the MaskInputRejected event.

As an example, in the "90/90/0000" date entry mask, the forward slash characters are literals. Assume that the user has entered two initial digits, "11", so the current position in the mask is at the first forward slash (/) literal. If SkipLiterals is true, then the user has the following valid choices:

  • The user can enter a "/" character. This results in the position being moved to the next character, which in this example is the fourth position, a 9 masking element.

  • The user can enter the next editable character, which in this example is a digit. The digit would be validated and the current position would automatically be moved to the fifth position, which is a 0 masking element.

If SkipLiterals is false, then only a valid data input is allowed, which in this example would be a digit.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0