MaskedTextBox.ResetOnPrompt Property

Definition

Gets or sets a value that determines how an input character that matches the prompt character should be handled.

public:
 property bool ResetOnPrompt { bool get(); void set(bool value); };
public bool ResetOnPrompt { get; set; }
member this.ResetOnPrompt : bool with get, set
Public Property ResetOnPrompt As Boolean

Property Value

true if the prompt character entered as input causes the current editable position in the mask to be reset; otherwise, false to indicate that the prompt character is to be processed as a normal input character. The default is true.

Remarks

The MaskedTextBox can treat two categories of characters - spaces and prompt characters - specially. Typically, each input character will be tested against the mask and either accepted or rejected. Assuming that the PromptChar property is set to non-null, then setting the ResetOnPrompt property to true will result in special processing for the prompt character. When the user enters the prompt character into the mask, it causes the current mask character position to be cleared and the current position to be advanced to the next editable character.

ResetOnPrompt takes precedence over the AllowPromptAsInput property, as shown in the following table.

ResetOnPrompt value AllowPromptAsInput value Resulting behavior
true true The prompt character can be entered and it causes the current mask position to be reset. This is the default.
true false The prompt character can be entered and it causes the current mask position to be reset.
false true The prompt character is processed as a standard input character.
false false The prompt character is not valid and raises a MaskInputRejected event.

Applies to

See also