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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using inputbox() , would like while typing the password to overwrite it with * 1

Status
Not open for further replies.
Jan 20, 2007
237
0
0
US
Hi Everyone,
Yes i know, i should use a form for "sign-in" but for now i am using the inputbox(), and would like to know if for each keystroke, is there a way while typing "secret", to overwrite each letter with "*"

below is the code

Thanks a lot in advance

Code:
Local lcPassword
lcPassword= Upper(Inputbox('Please enter password to open this','Enter Password'))
If Alltrim(m.lcPassword) ==  'SECRET'
	Do Form assyreps
Endif
 
No, this is not possible with an InputBox. It might conceivably be possible to trap every key with ON KEY, or maybe get the keystrokes with INKEY(), but it would be extrememly cludgy and probably not work anyway.

Creating your own password form would be much easier. As you probably, all you need is a label and a textbox, and the textbox would have its PasswordChar property set as appropriate.

Alternatively, you can use the ready-made Password Dialog Box Foundation Class, which you can find it _dialogs.vcx.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Landfla,
Use a textbox and set the property PasswordChar to *
Koen
 
Mike is right, create a modal form with a textbox (with the PasswordChar set as Koen suggests) and then you can add things that help, like Caps Lock warnings
and other useful stuff.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
One other point ....

If you create your own password as per my suggestion, set the PasswordChar property to CHR(108) (that's a lower-case "l"), and set the FontName to Wingdings. That way, you'll get a big chunky blob to hide the password. This looks much nicer than the sickly asterisk you get by default, in my opinion.

This applies if you are creating your own form. If you are using the Password Dialog Box Foundation Class, you will have to modify the underlying class to get the same effect (which is quite easy to do).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top