Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
InsertKeyMode Property

MaskedTextBox.InsertKeyMode Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the text insertion mode of the masked text box control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public InsertKeyMode InsertKeyMode { get; set; }
/** @property */
public InsertKeyMode get_InsertKeyMode ()

/** @property */
public void set_InsertKeyMode (InsertKeyMode value)

public function get InsertKeyMode () : InsertKeyMode

public function set InsertKeyMode (value : InsertKeyMode)

Property Value

An InsertKeyMode value that indicates the current insertion mode. The default is Default.

Exception typeCondition


An invalid InsertKeyMode value was supplied when setting this property.

The InsertKeyMode property controls the character insertion behavior of the MaskedTextBox control. The state of this property is defined by the MaskedTextBoxInsertMode enumeration, which can be always on, always off or set to respect the setting of the user's keyboard. This property supersedes the insertion mode of the keyboard. For example, if the keyboard is set to overwrite, but InsertKeyMode is set to Insert, the MaskedTextBox will operate in insert mode. The IsOverwriteMode property will access the true insertion mode of the MaskedTextBox.

If changing InsertKeyMode changes the value of IsOverwriteMode, MaskedTextBox will raise the IsOverwriteModeChanged event.

This property has no effect if no mask has been set.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft