Szerkesztés

Megosztás a következőn keresztül:


MaskedTextBox Constructors

Definition

Initializes a new instance of the MaskedTextBox class.

Overloads

MaskedTextBox()

Initializes a new instance of the MaskedTextBox class using defaults.

MaskedTextBox(MaskedTextProvider)

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

MaskedTextBox(String)

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

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

Applies to

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
Public Sub New (maskedTextProvider As MaskedTextProvider)

Parameters

maskedTextProvider
MaskedTextProvider

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

Exceptions

maskedTextProvider is null.

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

Applies to

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

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

Exceptions

mask is null.

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