- Home
·
- Encryption
·
- Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e
Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e
Professional login. Gives the user 3 tries and then boots them out. very simple and commented for easy understanding.
API Declarations
Dim strPW As String
Dim strUser As String
Dim intTries as Integer
Rate Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e
(2(2 Vote))
'Or it can just be used as is.
'1 Textbox called txtUser
'1 Textbox called txtPW
'1 Command Button called cmdOK
'add whatever else you want (i.e. Cancel button, graphics, etc..)
'You can use this code all you want.
'Credit or even a thank you is appreciated :)
'*********************
'Put this code in form load
'*********************
'sets count to zero
intTries = 0
txtUser.SetFocus
'************************
'Put this in the cmdOK Mouse_Up
'************************
'by using the mouse_up, this will allow the user to change his/her mind if they
'have clicked on the button and are still holding down the mouse
'removes spaces/case sensitivity
strUser = Trim(LCase(txtUser.text))
strPW = Trim(LCase(txtPW.text))
'checks to see if user name is correct
if strUser <> "user" then
msgbox "User not found",vbcritical,"Error""
txtUser.SetFocus
Exit sub
End If
'checks to see if the password is correct
If strPW <> "password" then
msgbox "Incorrect Password",vbcritical,"Error"
intTries = intTries + 1
If intTries = 3 then
msgbox "Too many tries!" & vbcrlf & "GoodBye",vbcritical,"Error"
End
End If
txtPW.SetFocus
txtPW.text = ""
Exit Sub
End If
'if both user and pw are correct, then it will load the next form
Unload Me
frmMain.show
Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e Comments
No comments yet — be the first to post one!
Post a Comment