by Bharathy (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 9th January 2001
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
This code is used to validate the number of times a user tries to enter the password.On invalid password received as input more than 3
If txtpwd.Text = "" Then 'textbox for entering the password value(change name to txtpwd)
MsgBox "Please enter a value"
txtpwd.setfocus
Else
Call pwd
End If
End Sub
Sub pwd()'procedure for password validation
Static cnt As Integer
cnt = cnt + 1
strpwd = txtpwd.Text
substring = Trim(strpwd)'to trim spaces
If cnt > 3 Then 'to check if the user has tried not more than 3 times
MsgBox Prompt:=("Sorry , your ID is locked")
End
End If
If strpwd <> "password" Or substring = "" Then
MsgBox Prompt:="Invalid password.Try again"
txtpwd.setfocus
Else
MsgBox Prompt:="Login successful!"
frmExit.Show 'This may vary depending on the action required
End If
End Sub
Private Sub Form_Load()
txtpwd.PasswordChar = "*" 'the format of password character
End Sub
No comments have been posted about This code is used to validate the number of times a user tries to enter the password.On invalid pas. Why not be the first to post a comment about This code is used to validate the number of times a user tries to enter the password.On invalid pas.