PasswordChar
I shall be as secret as the grave.
Miguel de Cervantes, Don Quixote de la Mancha
This property makes a task that used to be hard really easy. It lets you specify that a text box should display a particular character instead of the character input by the user. Use it to hide passwords while they're being input.
Usage |
txtTextbox.PasswordChar = cChar cChar = txtTextbox.PasswordChar |
Example |
* Assume there's a variable cPassword * containing the password for the current user. * * Create a form with a text box and a button * Using the property sheet, set the text box as follows: * PasswordChar = "*" && asterisks * InputMask = "AAAA" && four alphabetic chars * Format = "K" && select all on entry * Set the button as follows: * Caption = "Check" * In the Click method of the button, put: IF ThisForm.Text1.Value == cPassword * They pass - close the form RELEASE ThisForm ELSE * No good - tell the user WAIT WINDOW "Invalid Password. Try again" ThisForm.Text1.SetFocus ENDIF * * Save the form and run it. When you type in a bad * password and click Check, you get the message. * When you type in the right password, the form * closes. |
See Also |