Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​ComponentModel.​MaskedTextProvider
Assembly: System.ComponentModel.TypeConverter
Inheritance: object → MaskedTextProvider
Implemented Interfaces
Represents a mask-parsing service that can be used by any number of controls that support masking, such as the <see cref="T:System.Windows.Forms.MaskedTextBox" /> control.
Properties
public
bool
AllowPromptAsInput
Gets a value indicating whether the prompt character should be treated as a valid input character or not.
public
bool
AsciiOnly
Gets a value indicating whether the mask accepts characters outside of the ASCII character set.
public
int
AssignedEditPositionCount
Gets the number of editable character positions that have already been successfully assigned an input value.
public
int
AvailableEditPositionCount
Gets the number of editable character positions in the input mask that have not yet been assigned an input value.
Culture
Gets the culture that determines the value of the localizable separators and placeholders in the input mask.
public static
char
DefaultPasswordChar
Gets the default password character used obscure user input.
public
int
EditPositionCount
Gets the number of editable positions in the formatted string.
EditPositions
Gets a newly created enumerator for the editable positions in the formatted string.
public
bool
IncludeLiterals
Gets or sets a value that indicates whether literal characters in the input mask should be included in the formatted string.
public
bool
IncludePrompt
Gets or sets a value indicating whether <see cref="P:System.Windows.Forms.MaskedTextBox.PromptChar" /> is used to represent the absence of user input when displaying the formatted string.
public static
int
InvalidIndex
Gets the upper bound of the range of invalid indexes.
public
bool
IsPassword
Gets or sets a value that determines whether password protection should be applied to the formatted string.
public
char
Item
public
int
LastAssignedPosition
Gets the index in the mask of the rightmost input character that has been assigned to the mask.
public
int
Length
Gets the length of the mask, absent any mask modifier characters.
public
string
Mask
Gets the input mask.
public
bool
MaskCompleted
Gets a value indicating whether all required inputs have been entered into the formatted string.
public
bool
MaskFull
Gets a value indicating whether all required and optional inputs have been entered into the formatted string.
public
char
PasswordChar
Gets or sets the character to be substituted for the actual input characters.
public
char
PromptChar
Gets or sets the character used to represent the absence of user input for all available edit positions.
public
bool
ResetOnPrompt
Gets or sets a value that determines how an input character that matches the prompt character should be handled.
public
bool
ResetOnSpace
Gets or sets a value that determines how a space input character should be handled.
public
bool
SkipLiterals
Gets or sets a value indicating whether literal character positions in the mask can be overwritten by their same values.
Methods
public
bool
Add​(char input)
Adds the specified input character to the end of the formatted string.
Returns <see langword="true" /> if the input character was added successfully; otherwise <see langword="false" /> .
input
A <see cref="T:System.Char" /> value to be appended to the formatted string.
public
bool
Add​(string input)
Adds the characters in the specified input string to the end of the formatted string.
Returns <see langword="true" /> if all the characters from the input string were added successfully; otherwise <see langword="false" /> to indicate that no characters were added.
input
A <see cref="T:System.String" /> containing character values to be appended to the formatted string.
public
bool
Add​(string input,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
void
Clear​()
Clears all the editable input characters from the formatted string, replacing them with prompt characters.
public
object
Clone​()
Creates a copy of the current <see cref="T:System.ComponentModel.MaskedTextProvider" /> .
Returns The <see cref="T:System.ComponentModel.MaskedTextProvider" /> object this method creates, cast as an object.
public
int
FindAssignedEditPositionFrom​(int position,
bool direction)
Returns the position of the first assigned editable position after the specified position using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first assigned editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
position
The zero-based position in the formatted string to start the search.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindAssignedEditPositionInRange​(int startPosition,
int endPosition,
bool direction)
Returns the position of the first assigned editable position between the specified positions using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first assigned editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
startPosition
The zero-based position in the formatted string where the search starts.
endPosition
The zero-based position in the formatted string where the search ends.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindEditPositionFrom​(int position,
bool direction)
Returns the position of the first editable position after the specified position using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
position
The zero-based position in the formatted string to start the search.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindEditPositionInRange​(int startPosition,
int endPosition,
bool direction)
Returns the position of the first editable position between the specified positions using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
startPosition
The zero-based position in the formatted string where the search starts.
endPosition
The zero-based position in the formatted string where the search ends.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindNonEditPositionFrom​(int position,
bool direction)
Returns the position of the first non-editable position after the specified position using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first literal position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
position
The zero-based position in the formatted string to start the search.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindNonEditPositionInRange​(int startPosition,
int endPosition,
bool direction)
Returns the position of the first non-editable position between the specified positions using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first literal position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
startPosition
The zero-based position in the formatted string where the search starts.
endPosition
The zero-based position in the formatted string where the search ends.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindUnassignedEditPositionFrom​(int position,
bool direction)
Returns the position of the first unassigned editable position after the specified position using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first unassigned editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
position
The zero-based position in the formatted string to start the search.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public
int
FindUnassignedEditPositionInRange​(int startPosition,
int endPosition,
bool direction)
Returns the position of the first unassigned editable position between the specified positions using the specified search direction.
Returns If successful, an <see cref="T:System.Int32" /> representing the zero-based position of the first unassigned editable position encountered; otherwise <see cref="P:System.ComponentModel.MaskedTextProvider.InvalidIndex" /> .
startPosition
The zero-based position in the formatted string where the search starts.
endPosition
The zero-based position in the formatted string where the search ends.
direction
A <see cref="T:System.Boolean" /> indicating the search direction; either <see langword="true" /> to search forward or <see langword="false" /> to search backward.
public static
bool
GetOperationResultFromHint​(MaskedTextResultHint hint)
Determines whether the specified <see cref="T:System.ComponentModel.MaskedTextResultHint" /> denotes success or failure.
Returns <see langword="true" /> if the specified <see cref="T:System.ComponentModel.MaskedTextResultHint" /> value represents a success; otherwise, <see langword="false" /> if it represents failure.
hint
A <see cref="T:System.ComponentModel.MaskedTextResultHint" /> value typically obtained as an output parameter from a previous operation.
public
bool
InsertAt​(char input,
int position)
Inserts the specified character at the specified position within the formatted string.
Returns <see langword="true" /> if the insertion was successful; otherwise, <see langword="false" /> .
input
The <see cref="T:System.Char" /> to be inserted.
position
The zero-based position in the formatted string to insert the character.
public
bool
InsertAt​(char input,
int position,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
InsertAt​(string input,
int position)
Inserts the specified string at a specified position within the formatted string.
Returns <see langword="true" /> if the insertion was successful; otherwise, <see langword="false" /> .
input
The <see cref="T:System.String" /> to be inserted.
position
The zero-based position in the formatted string to insert the input string.
public
bool
InsertAt​(string input,
int position,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
IsAvailablePosition​(int position)
Determines whether the specified position is available for assignment.
Returns <see langword="true" /> if the specified position in the formatted string is editable and has not been assigned to yet; otherwise <see langword="false" /> .
position
The zero-based position in the mask to test.
public
bool
IsEditPosition​(int position)
Determines whether the specified position is editable.
Returns <see langword="true" /> if the specified position in the formatted string is editable; otherwise <see langword="false" /> .
position
The zero-based position in the mask to test.
public static
bool
IsValidInputChar​(char c)
Determines whether the specified character is a valid input character.
Returns <see langword="true" /> if the specified character contains a valid input value; otherwise <see langword="false" /> .
c
The <see cref="T:System.Char" /> value to test.
public static
bool
IsValidMaskChar​(char c)
Determines whether the specified character is a valid mask character.
Returns <see langword="true" /> if the specified character contains a valid mask value; otherwise <see langword="false" /> .
c
The <see cref="T:System.Char" /> value to test.
public static
bool
IsValidPasswordChar​(char c)
Determines whether the specified character is a valid password character.
Returns <see langword="true" /> if the specified character contains a valid password value; otherwise <see langword="false" /> .
c
The <see cref="T:System.Char" /> value to test.
public
bool
Remove​()
Removes the last assigned character from the formatted string.
Returns <see langword="true" /> if the character was successfully removed; otherwise, <see langword="false" /> .
public
bool
RemoveAt​(int position)
Removes the assigned character at the specified position from the formatted string.
Returns <see langword="true" /> if the character was successfully removed; otherwise, <see langword="false" /> .
position
The zero-based position of the assigned character to remove.
public
bool
RemoveAt​(int startPosition,
int endPosition)
Removes the assigned characters between the specified positions from the formatted string.
Returns <see langword="true" /> if the character was successfully removed; otherwise, <see langword="false" /> .
startPosition
The zero-based index of the first assigned character to remove.
endPosition
The zero-based index of the last assigned character to remove.
public
bool
RemoveAt​(int startPosition,
int endPosition,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Replace​(char input,
int position)
Replaces a single character at or beyond the specified position with the specified character value.
Returns <see langword="true" /> if the character was successfully replaced; otherwise, <see langword="false" /> .
input
The <see cref="T:System.Char" /> value that replaces the existing value.
position
The zero-based position to search for the first editable character to replace.
public
bool
Replace​(char input,
int startPosition,
int endPosition,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Replace​(char input,
int position,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Replace​(string input,
int position)
Replaces a range of editable characters starting at the specified position with the specified string.
Returns <see langword="true" /> if all the characters were successfully replaced; otherwise, <see langword="false" /> .
input
The <see cref="T:System.String" /> value used to replace the existing editable characters.
position
The zero-based position to search for the first editable character to replace.
public
bool
Replace​(string input,
int startPosition,
int endPosition,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Replace​(string input,
int position,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Set​(string input)
Sets the formatted string to the specified input string.
Returns <see langword="true" /> if all the characters were successfully set; otherwise, <see langword="false" /> .
input
The <see cref="T:System.String" /> value used to set the formatted string.
public
bool
Set​(string input,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
string
ToDisplayString​()
Returns the formatted string in a displayable form.
Returns The formatted <see cref="T:System.String" /> that includes prompts and mask literals.
public
string
ToString​()
Returns the formatted string that includes all the assigned character values.
Returns The formatted <see cref="T:System.String" /> that includes all the assigned character values.
public
string
ToString​(bool ignorePasswordChar)
Returns the formatted string, optionally including password characters.
Returns The formatted <see cref="T:System.String" /> that includes literals, prompts, and optionally password characters.
ignorePasswordChar
<see langword="true" /> to return the actual editable characters; otherwise, <see langword="false" /> to indicate that the <see cref="P:System.ComponentModel.MaskedTextProvider.PasswordChar" /> property is to be honored.
public
string
ToString​(bool includePrompt,
bool includeLiterals)
Returns the formatted string, optionally including prompt and literal characters.
Returns The formatted <see cref="T:System.String" /> that includes all the assigned character values and optionally includes literals and prompts.
includePrompt
<see langword="true" /> to include prompt characters in the return string; otherwise, <see langword="false" /> .
includeLiterals
<see langword="true" /> to include literal characters in the return string; otherwise, <see langword="false" /> .
public
string
ToString​(bool ignorePasswordChar,
bool includePrompt,
bool includeLiterals,
int startPosition,
int length)
Returns a substring of the formatted string, optionally including prompt, literal, and password characters.
Returns If successful, a substring of the formatted <see cref="T:System.String" /> , which includes all the assigned character values and optionally includes literals, prompts, and password characters; otherwise the <see cref="F:System.String.Empty" /> string.
ignorePasswordChar
<see langword="true" /> to return the actual editable characters; otherwise, <see langword="false" /> to indicate that the <see cref="P:System.ComponentModel.MaskedTextProvider.PasswordChar" /> property is to be honored.
includePrompt
<see langword="true" /> to include prompt characters in the return string; otherwise, <see langword="false" /> .
includeLiterals
<see langword="true" /> to return literal characters in the return string; otherwise, <see langword="false" /> .
startPosition
The zero-based position in the formatted string where the output begins.
length
The number of characters to return.
public
string
ToString​(bool includePrompt,
bool includeLiterals,
int startPosition,
int length)
Returns a substring of the formatted string, optionally including prompt and literal characters.
Returns If successful, a substring of the formatted <see cref="T:System.String" /> , which includes all the assigned character values and optionally includes literals and prompts; otherwise the <see cref="F:System.String.Empty" /> string.
includePrompt
<see langword="true" /> to include prompt characters in the return string; otherwise, <see langword="false" /> .
includeLiterals
<see langword="true" /> to include literal characters in the return string; otherwise, <see langword="false" /> .
startPosition
The zero-based position in the formatted string where the output begins.
length
The number of characters to return.
public
string
ToString​(bool ignorePasswordChar,
int startPosition,
int length)
Returns a substring of the formatted string, optionally including password characters.
Returns If successful, a substring of the formatted <see cref="T:System.String" /> , which includes literals, prompts, and optionally password characters; otherwise the <see cref="F:System.String.Empty" /> string.
ignorePasswordChar
<see langword="true" /> to return the actual editable characters; otherwise, <see langword="false" /> to indicate that the <see cref="P:System.ComponentModel.MaskedTextProvider.PasswordChar" /> property is to be honored.
startPosition
The zero-based position in the formatted string where the output begins.
length
The number of characters to return.
public
string
ToString​(int startPosition,
int length)
Returns a substring of the formatted string.
Returns If successful, a substring of the formatted <see cref="T:System.String" /> , which includes all the assigned character values; otherwise the <see cref="F:System.String.Empty" /> string.
startPosition
The zero-based position in the formatted string where the output begins.
length
The number of characters to return.
public
bool
VerifyEscapeChar​(char input,
int position)
Tests whether the specified character would be escaped at the specified position.
Returns <see langword="true" /> if the specified character would be escaped at the specified position; otherwise, <see langword="false" /> .
input
The <see cref="T:System.Char" /> value to test.
position
The position in the mask to test the input character against.
public
bool
VerifyString​(string input)
Tests whether the specified string could be set successfully.
Returns <see langword="true" /> if the specified string represents valid input; otherwise, <see langword="false" /> .
input
The <see cref="T:System.String" /> value to test.
public
bool
VerifyString​(string input,
Int32& testPosition,
MaskedTextResultHint& resultHint)
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object