Hi
I have below code in Vb6 but i want that characters should not be visible
Dim password As String
password = InputBox("Enter the Password : ")
Thanks
Hi
I have below code in Vb6 but i want that characters should not be visible
Dim password As String
password = InputBox("Enter the Password : ")
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sophia CarterRank #4,018 · 371 reputationPosted Apr 22, 2025, 4:27 AM EDT
Hello! It seems like you are looking to enhance the security of your password input in VB6 by making the characters entered by the user not visible. In VB6, there isn't a built-in feature to directly hide characters in an InputBox like you would see in modern password input fields on websites.
However, a common approach to achieve this is by creating a custom dialog form where you simulate the behavior of a password input field by displaying asterisks (*) instead of the actual characters entered by the user. You can then capture the user's input without displaying it on the screen.
Here's a simplified example of how you can achieve this in VB6:
Private Sub Command1_Click() Dim password As String password = MaskedInputBox("Enter the Password:") MsgBox "You entered: " & password End Sub Function MaskedInputBox(prompt As String) As String Dim frmInput As New Form Dim txtPassword As New TextBox Dim btnOK As New CommandButton frmInput.Caption = "Password Input" frmInput.Width = 200 frmInput.Height = 100 txtPassword.PasswordChar = "*" txtPassword.Width = 120 txtPassword.Top = 20 txtPassword.Left = 20 btnOK.Caption = "OK" btnOK.Default = True btnOK.Width = 60 btnOK.Top = 50 btnOK.Left = 70 frmInput.Controls.Add txtPassword frmInput.Controls.Add btnOK frmInput.Show txtPassword.SetFocus frmInput.Hide MaskedInputBox = txtPassword.Text Unload frmInput End FunctionIn this example, the `MaskedInputBox` function creates a custom input dialog with a text box that displays asterisks for each character entered by the user. Once the user enters the password and clicks "OK", the actual password string is returned for further processing.
I hope this information helps you achieve the desired character visibility behavior for password input in your VB6 application. If you have any more questions or need further clarification, feel free to ask!