Search Tools Links Login

[ Password Protection With Up To 3 Attemps ]

This will ask the user to enter a password and if it is incorrect it will give them two more chances (three attempts in total). Please vote and leave comments :)

Original Author: JamesJD


One Command Button name Command1.


Private Sub Command1_Click()
  Dim Password As String
  Dim InputPassword As String
  Dim Attempt As Integer
  Password = "Secret"
  Attempt = 0
    InputPassword = InputBox("Enter password. This is attempt number " & Attempt & ".")
    Attempt = Attempt + 1
  Loop Until (Attempt = 3) Or (InputPassword = Password)
  If InputPassword = Password Then
    MsgBox ("This password is valid!")
    MsgBox ("This password is invalid!")
  End If
End Sub

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 237 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.