Masked Provider Text
Masked Provider Text
Masked Provider Text
Represents a mask-parsing service that can be used by any number of controls that support masking, such as the MaskedTextBox control.
public ref class MaskedTextProvider : ICloneable
public class MaskedTextProvider : ICloneable
type MaskedTextProvider = class interface ICloneable
Public Class MaskedTextProvider Implements ICloneable
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 MaskedTextProvider 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 MaskedTextProvider. For example, the MaskedTextBox.PromptChar property of the MaskedTextBox class refers all access to the PromptChar of the MaskedTextProvider class.
The mask-parsing engine used by 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 Mask property.
The following three distinct strings are involved with the 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 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.|
|Mask||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.|
|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 Item[Int32], 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.
|AllowPromptAsInput AllowPromptAsInput AllowPromptAsInput AllowPromptAsInput||
Gets a value indicating whether the prompt character should be treated as a valid input character or not.
|AsciiOnly AsciiOnly AsciiOnly AsciiOnly||
Gets a value indicating whether the mask accepts characters outside of the ASCII character set.
|AssignedEditPositionCount AssignedEditPositionCount AssignedEditPositionCount AssignedEditPositionCount||
Gets the number of editable character positions that have already been successfully assigned an input value.
|AvailableEditPositionCount AvailableEditPositionCount AvailableEditPositionCount AvailableEditPositionCount||
Gets the number of editable character positions in the input mask that have not yet been assigned an input value.
|Culture Culture Culture Culture||
Gets the culture that determines the value of the localizable separators and placeholders in the input mask.
|DefaultPasswordChar DefaultPasswordChar DefaultPasswordChar DefaultPasswordChar||
Gets the default password character used obscure user input.
|EditPositionCount EditPositionCount EditPositionCount EditPositionCount||
Gets the number of editable positions in the formatted string.
|EditPositions EditPositions EditPositions EditPositions||
Gets a newly created enumerator for the editable positions in the formatted string.
|IncludeLiterals IncludeLiterals IncludeLiterals IncludeLiterals||
Gets or sets a value that indicates whether literal characters in the input mask should be included in the formatted string.
|IncludePrompt IncludePrompt IncludePrompt IncludePrompt||
Gets or sets a value indicating whether PromptChar is used to represent the absence of user input when displaying the formatted string.
|InvalidIndex InvalidIndex InvalidIndex InvalidIndex||
Gets the upper bound of the range of invalid indexes.
|IsPassword IsPassword IsPassword IsPassword||
Gets or sets a value that determines whether password protection should be applied to the formatted string.
|Item[Int32] Item[Int32] Item[Int32] Item[Int32]||
Gets the element at the specified position in the formatted string.
|LastAssignedPosition LastAssignedPosition LastAssignedPosition LastAssignedPosition||
Gets the index in the mask of the rightmost input character that has been assigned to the mask.
|Length Length Length Length||
Gets the length of the mask, absent any mask modifier characters.
|Mask Mask Mask Mask||
Gets the input mask.
|MaskCompleted MaskCompleted MaskCompleted MaskCompleted||
Gets a value indicating whether all required inputs have been entered into the formatted string.
|MaskFull MaskFull MaskFull MaskFull||
Gets a value indicating whether all required and optional inputs have been entered into the formatted string.
|PasswordChar PasswordChar PasswordChar PasswordChar||
Gets or sets the character to be substituted for the actual input characters.
|PromptChar PromptChar PromptChar PromptChar||
Gets or sets the character used to represent the absence of user input for all available edit positions.
|ResetOnPrompt ResetOnPrompt ResetOnPrompt ResetOnPrompt||
Gets or sets a value that determines how an input character that matches the prompt character should be handled.
|ResetOnSpace ResetOnSpace ResetOnSpace ResetOnSpace||
Gets or sets a value that determines how a space input character should be handled.
|SkipLiterals SkipLiterals SkipLiterals SkipLiterals||
Gets or sets a value indicating whether literal character positions in the mask can be overwritten by their same values.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.