VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e

by Capp00 (8 Submissions)
Category: Encryption
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 4th September 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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

Download this snippet    Add to My Saved Code

Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e Comments

No comments have been posted about Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e. Why not be the first to post a comment about Professional login. Gives the user 3 tries and then boots them out. very simple and commented for e.

Post your comment

Subject:
Message:
0/1000 characters