password

Hi. I want thes users of my applications to see ****** instead of letters or numbers that they write in password textbox. How can I do that?
[140 byte] By [Bartosz] at [2007-12-23]
# 1

Thats what the maskedtextbox control does for you:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx

MaskedTextBox Class

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

Uses a mask to distinguish between proper and improper user input.

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

Edit:

I suggested using the masked textbox for the passwords because you not only can use the password character property to hide user input , you can also utilize the masking property of the control to restrict and control user input...which is nice when you do not want non-alphanumeric characters to appear in the password

DMan1 at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2

on the textbox you are entering the password in the Designer, select the textbox then in the properties, set the "PasswordChar" to the character you wish to present the text, so type in say * and press enter

the textbox will now mask/cover up the entered text with the passwordChar entered

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 3
Yeah DMan, I think thats wrong....
AndrewVos at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 4
thanks. You guys know answer to every question .
Bartosz at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 5

Agreed, use the PasswordChar in the Windows Textbox. Do not use the MaskedTextBox. It will give you prompt characters and allow only specific characters to be entered. It will not hide the entered text (unless the above mentioned PasswordChar property is entered as MaskedTextBox inherits from TextBoxBase which provies that functionality).

If this is the Asp:TextBox you can set the TextMode to Password and will see the same behavior.

Jim Wooley
http://devauthority.com/blogs/jwooley

jwooley at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 6

As a side note, you can use:

TextPass.PasswordChar = ChrW(&H25CF)

To set your password character to a big black blob, instead of an asterisk.

SJWhiteley at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...