PasswordChar Property

See AlsoJ3PK3T                 Example1W5Z91P>Low

Applies To

Text boxYPYZDG.

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$LANCHR(42)).

This property does not affect the Text14TWSRU property; it contains exactly what the user types or what was set from code.  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

String7WSH0XQ


See Also

Help:

Text Property14TWSRU

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"


PasswordChar Property Example

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