This documentation is archived and is not being maintained.

MaskedTextBox.PromptChar Property

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

Gets or sets the character used to represent the absence of user input in MaskedTextBox.

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

<LocalizableAttribute(True)> _
Public Property PromptChar As Char
Dim instance As MaskedTextBox
Dim value As Char

value = instance.PromptChar

instance.PromptChar = value
/** @property */
public char get_PromptChar ()

/** @property */
public void set_PromptChar (char value)

public function get PromptChar () : char

public function set PromptChar (value : char)

Property Value

The character used to prompt the user for input. The default is an underscore (_).

Exception typeCondition


The character specified when setting this property is not a valid prompt character, as determined by the IsValidPasswordChar method of the MaskedTextProvider class.


The prompt character specified is the same as the current password character, PasswordChar. The two are required to be different.

PromptChar will be displayed in MaskedTextBox for any mask position that the user has not yet filled in.

Use the HidePromptOnLeave property to specify whether the prompt is displayed when MaskedTextBox does not have focus.

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