See Also Example
Applies To
Text box.
Description
Determines whether the characters typed by a user or placeholder characters are displayed in a text box; determines the character used as a placeholder.
Usage
[form.]textbox.PasswordChar[ = stringexpression ]
Remarks
Use this property to create a password field in a dialog box. Although you can use any character, most applications for Windows use the asterisk (*) (Chr$ (42)).
This property does not affect the Text Set PasswordChar to an empty string ("") or to Chr$(0) to display the actual text. The default is an empty string.
You can assign any string to this property, but only the first character is significant; all others are ignored.
Data Type
String
Help:
Text Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
The example illustrates how the PasswordChar property affects the way a text box displays text. To try this example, paste the code into the Declarations section of a form that contains a text box. Then press F5 and click the form. Each time you click the form, the text toggles between an asterisk password character and plain text.
Sub Form_Click ()
If Text1.PasswordChar = "" Then
Text1.PasswordChar = "*"
Else
Text1.PasswordChar = ""
End If
End Sub