Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display ***** when entering Passwords

Status
Not open for further replies.

ChuckFraser

Programmer
Jul 2, 2002
3
CA
I would like to display asterisks ( ***** ) when a user enters their password into the provided field, but at the same time, I want to retain the value they are actually entering. Does anyone have a simple solution for this? Thanks in advance for your time.
Chuck Fraser
Breken Technologies Group
Email: cfraser@breken.com
Web:
 
Chuck,

You have to use two field objects:

1. fldPassword has a font.color matching the background color.

2. fldAsterisk is precisely the same height and width of fldPassword, lies on top of fldPassword, and is a calculated field with the following calculation:

Code:
   fill( "*", size( fldPassword.Value ) )

3. In the keyPhysical event of fldPassword, add the following code:

Code:
   doDefault
   fldAsterisk.action( DataRecalc )

4. The Font of both field objects is set to a monospaced font, like Courier New.

5. To get the password at Runtime, grab the value of fldPassword when the user presses Enter or clicks the OK button.

This works like the effects of stage magicians; that is, through misdirection. The users sees asterisks when they type their password, but not the real one.

By the way, this is the bare bones version. There are other bits you can add. Some of these will be included in the article's URL I post when I get it finished.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top