Stephen Oberauer
Stephen Oberauer

Reputation: 5395

How can I use the DevExpress WinForms TextEdit as a password entry (with asterisks)?

According to http://www.devexpress.com/Products/NET/Controls/WinForms/Editors/editors/textEdit.xml one can use the Developer Express TextEdit control to input a password and hide the characters. Can anyone explain to me how to do this? It seems like it should be really simple.

Upvotes: 3

Views: 20120

Answers (3)

Niranjan Singh
Niranjan Singh

Reputation: 18290

Use RepositoryItemTextEdit.PasswordChar Property

The TextEdit has a Properties.PasswordChar property, which is empty by default. By >setting some char there (for example, *), you will enable the functionality you require.

Password mode allows you to mask the editor's text. You can activate password mode in two ways:

  • Set the UseSystemPasswordChar property to true. The editor's text will be masked as follows:

  • Set the PasswordChar property to any valid character. This character will be used to mask the editor's text.

    For instance, if the PasswordChar property is set to "*", an editor will work as you want to do.

Note: The PasswordChar property is ignored if the RepositoryItemMemoEdit.UseSystemPasswordChar property is set to true.

Pragmatically you can set it as:

 TextEdit.Properties.PasswordChar = '*'

And From GUI go to Properties section and then further look for the Properties there you will get the PasswordChar property, Set it to valid character as per documentation. e.g. *.

Upvotes: 10

Daniel
Daniel

Reputation: 444

You can achieve the same with the regular TextBox control if you set the TextBox.UseSystemPasswordChar to true. This setting will also cause the TextBox control to display a tooltip warning if your CapsLock is on, just like in the Windows Login screen.

Upvotes: 1

Marek Dzikiewicz
Marek Dzikiewicz

Reputation: 2884

Set PasswordChar property of TextBox to the character which should be visible in the text box instead of the real text.

For example:

textBox.PasswordChar = '*';

Upvotes: 2

Related Questions