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

HOW TO USE PASSWORD CHAR IN INPUTBOX?

Status
Not open for further replies.

vcavusoglu

Programmer
Apr 26, 2001
41
TR
HOW TO USE PASSWORD CHAR IN INPUTBOX? OR ALTERNATIVE
 
Set the PasswordCharacter property equal to the character you want all characters to be displayed as in the text box.

-Sean
 
Add a form called frmPassword. It will show modally.
Put a Public procedure in Form frmPassword.
frmPassword has a label for prompt, a textbox for entry and commands control array of OK and Cancel. Set textbox passwordchar to "*".

code:--------------------------------------------------------------------------------
' in Main Form
strPassword = frmpassword.GetPassword("Enter your password")
if Len(strPassword) = 0 then ' no entry
'........
else
'.... password entered
End if

'frmPassword
Option Explicit
Public Function GetPassword(Optional ByVal strPrompt As String = "") As String
lblPassword = strPrompt
Me.Show vbModal ' Modal form, waits for Hide, visible=false
GetPassword = txtPassword

Unload Me
End Function
Private Sub cmdOKCancel_Click(Index As Integer)
If cmdOKCancel(1).Value Then ' Cancelled
txtPassword = ""
End If
Me.Hide ' Release modal
End Sub


Private Sub Form_Unload(Cancel As Integer)
Set frmPassword = Nothing ' Release everything
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top