Represents a mask-parsing service that can be used by any number of controls that support masking, such as the System.Windows.Forms.MaskedTextBox control.
See Also: MaskedTextProvider Members
The System.Windows.Forms.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 System.Windows.Forms.MaskedTextBox, Windows Forms provides it as a separate service, represented by the System.ComponentModel.MaskedTextProvider class, which defines the syntax of the masking language discussed in the documentation for the System.Windows.Forms.MaskedTextBox.Mask property.
Many of the members of the System.Windows.Forms.MaskedTextBox class refer their implementation to similarly named members of the associated System.ComponentModel.MaskedTextProvider. For example, the System.Windows.Forms.MaskedTextBox.PromptChar property of the System.Windows.Forms.MaskedTextBox class refers all access to the MaskedTextProvider.PromptChar of the System.ComponentModel.MaskedTextProvider class.
The mask-parsing engine used by System.ComponentModel.MaskedTextProvider is modeled after the Masked Edit control included in Microsoft Visual Basic version 6. Its masking language is described in the documentation for the MaskedTextProvider.Mask property.
The following three distinct strings are involved with the System.ComponentModel.MaskedTextProvider 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 erload:System.ComponentModel.MaskedTextProvider.Add, erload:System.ComponentModel.MaskedTextProvider.Replace, erload:System.ComponentModel.MaskedTextProvider.InsertAt, and erload:System.ComponentModel.MaskedTextProvider.Remove. Therefore, the input string cannot be accessed directly. However, aspects of the input string handling are available though the MaskedTextProvider.AllowPromptAsInput and MaskedTextProvider.AsciiOnly, MaskedTextProvider.ResetOnPrompt, and MaskedTextProvider.ResetOnSpace properties. |
Mask |
Represents the input formatting mask used to transform the input string into the formatted string. This string is set in the erload:System.ComponentModel.MaskedTextProvider.#ctor and accessed primarily though the MaskedTextProvider.Mask property. Characteristics of the mask are also available through other members, such as the MaskedTextProvider.Length, MaskedTextProvider.PasswordChar, and MaskedTextProvider.PromptChar properties. |
Formatted string |
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 MaskedTextProvider.Item(int), MaskedTextProvider.Length, MaskedTextProvider.LastAssignedPosition, MaskedTextProvider.MaskFull, MaskedTextProvider.MaskCompleted, MaskedTextProvider.FindEditPositionFrom(int, bool), and so on. The full value of the formatted string is available from the MaskedTextProvider.ToDisplayString and erload:System.ComponentModel.MaskedTextProvider.ToString methods. |
The input string may represent direct user input, as in the case of the System.Windows.Forms.MaskedTextBox, or may be generated by other processes not directly associated with user input/output operations.