MaskedTextBox.SelectedText Property

Definition

Gets or sets the current selection in the MaskedTextBox control.

public:
 virtual property System::String ^ SelectedText { System::String ^ get(); void set(System::String ^ value); };
public override string SelectedText { get; set; }
member this.SelectedText : string with get, set
Public Overrides Property SelectedText As String

Property Value

The currently selected text as a String. If no text is currently selected, this property resolves to an empty string.

Remarks

Selections retrieved using this property are formatted according to the control's formatting properties, such as Mask, FormatProvider, TextMaskFormat and CutCopyMaskFormat. Selections set using this property behave like a Paste operation: each character is matched against the mask, and the MaskInputRejected event is raised for invalid characters. If CutCopyMaskFormat is true, literals and prompt characters are allowed when setting SelectedText, and will be removed silently unless they violate the mask.

Applies to

See also