Home »
.Net »
C#.Net »
C#.Net Windows Development
TextBox.PasswordChar Property with Example in C#.Net
C#.Net - TextBox.PasswordChar Property with Example: Here we are going to learn about the PasswordChar property of TextBox Control in C#.Net Windows Application Development.
Submitted by IncludeHelp, on September 03, 2018
Here we are demonstrating use of PasswordChar property of TextBox.
Using TextBox.PasswordChar property we can set any special character for display in the TextBox, It is basically used for password input in Windows application development.
Example:
In this example, we took a Windows form that contains a TextBox named txtInput, Here, we are setting PasswordChar property to asterisk sign (*) to input password character. In the above image – we actually input "ABCD", but instead of "ABCD" it displayed "****".
Change the property using code:
private void Form1_Load(object sender, EventArgs e)
{
textInput.PasswordChar = '*';
}