MaskedTextBox MaskedTextBox MaskedTextBox MaskedTextBox Constructors

Definition

Overloads

MaskedTextBox() MaskedTextBox() MaskedTextBox()

Initializes a new instance of the MaskedTextBox class using defaults.

MaskedTextBox(MaskedTextProvider) MaskedTextBox(MaskedTextProvider) MaskedTextBox(MaskedTextProvider)

Initializes a new instance of the MaskedTextBox class using the specified custom mask language provider.

MaskedTextBox(String) MaskedTextBox(String) MaskedTextBox(String) MaskedTextBox(String)

Initializes a new instance of the MaskedTextBox class using the specified input mask.

MaskedTextBox() MaskedTextBox() MaskedTextBox()

Initializes a new instance of the MaskedTextBox class using defaults.

public:
 MaskedTextBox();
public MaskedTextBox ();
Public Sub New ()

Remarks

The default MaskedTextBox() constructor sets the MaskedTextProvider property to a null mask, represented by the string "<>". A null mask will accept any combination of characters as input.

See also

MaskedTextBox(MaskedTextProvider) MaskedTextBox(MaskedTextProvider) MaskedTextBox(MaskedTextProvider)

Initializes a new instance of the MaskedTextBox class using the specified custom mask language provider.

public:
 MaskedTextBox(System::ComponentModel::MaskedTextProvider ^ maskedTextProvider);
public MaskedTextBox (System.ComponentModel.MaskedTextProvider maskedTextProvider);
new System.Windows.Forms.MaskedTextBox : System.ComponentModel.MaskedTextProvider -> System.Windows.Forms.MaskedTextBox

Parameters

maskedTextProvider
MaskedTextProvider MaskedTextProvider MaskedTextProvider MaskedTextProvider

A custom mask language provider, derived from the MaskedTextProvider class.

Exceptions

Remarks

The maskedTextProvider parameter defines the masking language used by MaskedTextBox. It is responsible for parsing the mask and determining whether user input conforms to the current mask position. You can derive a new class from System.ComponentModel.MaskedTextProvider to define your own custom masking language, and use the MaskedTextBox(MaskedTextProvider) constructor to replace the standard System.ComponentModel.MaskedTextProvider.

If you want to use the default masking language and supply your own input mask, you do not need to use this constructor. Instead, you can either use the MaskedTextBox(String) constructor, or use the parameterless constructor then set the Mask property.

See also

MaskedTextBox(String) MaskedTextBox(String) MaskedTextBox(String) MaskedTextBox(String)

Initializes a new instance of the MaskedTextBox class using the specified input mask.

public:
 MaskedTextBox(System::String ^ mask);
public MaskedTextBox (string mask);
new System.Windows.Forms.MaskedTextBox : string -> System.Windows.Forms.MaskedTextBox
Public Sub New (mask As String)

Parameters

mask
String String String String

A String representing the input mask. The initial value of the Mask property.

Exceptions

Remarks

The MaskedTextBox(String) constructor uses the standard System.ComponentModel.MaskedTextProvider with the input mask to parse user input into the MaskedTextBox.

If you assign a new mask to the Mask property, it will override the value set by this constructor.

See also

Applies to