• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Simple Password Program

Hey,

Could you guys (or gals) please inform me how i can use a text box so when data is input, the actual data does not appear only astericks appear. I am trying to make a simple password program and would obvously not want the input pasword to be shown.

Thanks
0
gregman22
Asked:
gregman22
1 Solution
 
EverythingVBCommented:
in the Properties for your text box, set the PasswordChar to the astrick symbol

0
 
BarcaCommented:
Private Sub cmdLogin_Click()
    If (txtLogin.Text) = "login" and (txtPassword.Text) = "password" Then
        Unload Me
        form1.show
    End If
End Sub

would obvously not want the input pasword to be shown.<<

type * in testbox properties Passwordchar
0
 
applayerCommented:
here's a procedure you could use for a simple password program:

1. start a new project, a standard .exe
2. add a textbox called text1
3. add a command button called command1
4. add a label called label1
5. paste the following code and you should be ready to go!

' begin code ----------------------------------

Option Explicit

' this code will configure your form
Private Sub Form_Load()

  Me.Width = 4000
  Me.Height = 4000
  Me.Left = Screen.Width / 2 - Me.Width / 2
  Me.Top = Screen.Height / 2 - Me.Height / 2
  Me.Caption = "Password Screen"
  Me.KeyPreview = True

  Label1.Width = 3000
  Label1.Height = 1000
  Label1.Left = 200
  Label1.Top = 200
  Label1.Caption = "Please enter your password in the field below.  Then press the 'Submit' button to begin using the system."
 
 
  Text1.Width = 3500
  Text1.Font.Size = 12
  Text1.Left = 200
  Text1.Top = Label1.Top + Label1.Height + 100
  Text1.PasswordChar = "*"
  Text1.Text = ""
  Text1.TabIndex = 0
 
  Command1.Top = Text1.Top + Text1.Height + 400
  Command1.Left = 200
  Command1.Caption = "Submit"
  Command1.Width = 3500
  Command1.TabIndex = 1

End Sub

' this code will compare what the user entered to a defined password
Private Sub Command1_click()
  Dim strPassword As String
  strPassword = "password"
  If Text1.Text = strPassword Then
    Call Success
  Else
    Call Failure
  End If
End Sub

' this is your code for when the password is correct
Private Sub Success()
  Dim varMessage As Variant
  varMessage = MsgBox("Your code for success can go here", vbInformation, "Password Screen")
End Sub

' this is your code for when the password is not correct
Private Sub Failure()
  Dim varMessage As Variant
  varMessage = MsgBox("Your code for failure can go here", vbInformation, "Password Screen")
End Sub

' end code ----------------------------------
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now