N/APosted on - 04/05/2012
I am a newbie in learning visual basic 6.0 and I'm creating a login form for my visual basic project. I want to hide the password character on the textbox but I don't know how to do that. I want the * symbol to appear instead of my input. I need a little help with it.
Hide the password character in the textbox
Hiding the password from display
Dim str As String
Private Sub Text1_KeyPress(KeyAscii As Integer)
str = str + KeyAscii
KeyAscii = Asc("*")
make a variable global( here str).
then change the event of the text box to KeyPress event.
Key Ascii contains the ASC key of the character pressed recently.
store the value in the global variable
then change the KeyAscii to asc key value of *.
you can now print the ‘str’ variable.
The value is thus kept hidden and secured.
Another way is by left-click the text box.
goto properties dialog box.
under Password Char, enter the character you like to show instead of the original. now run the program and see the difference.
Waiting for your feedback please.