This documentation is archived and is not being maintained.

MaskedTextBox Constructor (MaskedTextProvider)

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

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public MaskedTextBox(
	MaskedTextProvider maskedTextProvider


Type: System.ComponentModel.MaskedTextProvider
A custom mask language provider, derived from the MaskedTextProvider class.


maskedTextProvider is null.

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 default constructor then set the Mask property.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.