IMaskedTextProvider
ReferencesInterface for a masked text provider that can be used with MaskedTextBox.
Remarks: This defines the interface that the MaskedTextBox uses when inserting, deleting, and clearing characters from a masked string. This can be implemented by both variable and fixed masks (unlike the standard System.ComponentModel.MaskedTextProvider), and provides a way to create your own completely custom masks. You can also use the VariableMaskedTextProvider as a base for custom masks to implement the default functionality.
Properties
IsEmpty
#Gets a value indicating the mask is empty with no characters filled out.
Value:
true if the mask value is empty; otherwise, false.MaskCompleted
#Gets a value indicating whether the mask has all required text to pass its validation.
Value:
true if mask is completed; otherwise, false.Text
#Gets or sets the text, usually excluding prompt or literal characters depending on the mask provider.
Methods
Clear
#Called to clear a range of characters at the specified position in the masked text.
Remarks: The cleared characters usually show the prompt character after cleared. This is useful for fixed length mask providers. For variable length, this is usually the same as calling Delete(int, int, bool).
Parameters:
| position (ref int) | Position to clear at. |
| length (int) | Length of text (in the mask) to clear |
| forward (bool) | true to delete the text forward, or false to delete backward |
Returns:
true when the deletion was successful, or false if it failed.void CommitText()
Called to update the display text after changes to the mask value.
Remarks: This is called after user changes to the mask value is complete, such as when the control loses focus, or when the user presses enter. This allows the mask provider to update the display text after changes are made to the value, while still allowing the user to type in the text without it changing until they are done.
Delete
#Called to delete a range of characters at the specified position in the masked text.
Insert
#Called to insert a character at the specified position in the masked text.
Returns:
true when the insertion was successful, or false if it failed.Replace
#Called to replace a character at the specified position in the masked text.
Returns:
true when the replacement was successful, or false if it failed.