Represents a mask-parsing service that can be used by any number of controls that support masking, such as the MaskedTextBox control.
Assembly: System (in System.dll)
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
The MaskedTextBox control contains a mask, composed of literal characters and formatting elements, that it tests all user input against. Instead of permanently associating a specific mask-parsing engine with MaskedTextBox, Windows Forms provides it as a separate service, represented by the class, which defines the syntax of the masking language discussed in the documentation for the Mask property.
Many of the members of the MaskedTextBox class refer their implementation to similarly named members of the associated . For example, the MaskedTextBox.PromptChar property of the MaskedTextBox class refers all access to the PromptChar of the class.
The mask-parsing engine used by is modeled after the Masked Edit control included in Microsoft Visual Basic version 6. Its masking language is described in the documentation for the Mask property.
The following three distinct strings are involved with the class.
Input character or string
Represents the characters used as input that the mask is applied against. In actuality, the input string may be composed of multiple input operations, including Add, Replace, InsertAt, and Remove. Therefore, the input string cannot be accessed directly. However, aspects of the input string handling are available though the AllowPromptAsInput and AsciiOnly, ResetOnPrompt, and ResetOnSpace properties.
Represents the input formatting mask used to transform the input string into the formatted string. This string is set in the MaskedTextProvider and accessed primarily though the Mask property. Characteristics of the mask are also available through other members, such as the Length, PasswordChar, and PromptChar properties.
Represents the string that results when the full mask is applied to the input string. The formatted string can be queried with many members of the class, including Item, Length, LastAssignedPosition, MaskFull, MaskCompleted, FindEditPositionFrom, and so on. The full value of the formatted string is available from the ToDisplayString and ToString methods.
The input string may represent direct user input, as in the case of the MaskedTextBox, or may be generated by other processes not directly associated with user input/output operations.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.