Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 119,058 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,511 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



HOW DO I REFUSES THE ACCESS AFTER THREE INCORRECT NAME OR PASSWORD

 
Reply to this topicStart new topic

HOW DO I REFUSES THE ACCESS AFTER THREE INCORRECT NAME OR PASSWORD

SEAHGIP
post 30 Jul, 2008 - 07:31 PM
Post #1


New D.I.C Head

*
Joined: 30 Jul, 2008
Posts: 1

CODE

Private Sub cmdLog_Click()
Dim var1 As Integer
Dim var2 As Integer

If txtName.Text = "SEAH GIAP SIANG" Then
    If txtPassword.Text <> "1234" Then
        Select Case var1
        Case Is <= 3
        MsgBox "The password is incorrect", vbExclamation, "INCORRECT PASSWORD"
        var1 = var1 + 1
        Case Else
        MsgBox "You have entered the wrong password too many times,the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
        Unload Me
        End Select
        Else
        frmWelcome.Hide
        'frmSplash.Show
    End If
    
Else
    Select Case var1
    Case Is <= var2
    MsgBox "The name is incorrect", vbExclamation, "INCORRECT NAME"
    var1 = var1 + 1
    Case Is <= var2
    MsgBox "You have entered the wrong name too many times, the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
    End
    End Select
  
End If
End Sub


** Edit ** code.gif
User is offlineProfile CardPM

Go to the top of the page


no2pencil
post 30 Jul, 2008 - 07:35 PM
Post #2


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 5,540



Thanked 36 times

Dream Kudos: 2350

Expert In: Goofing Off

My Contributions


You need to add some form of checking how many times the user tries to log in, & increment the value every time that they supply the wrong password.

CODE

        Dim Login_Error as Int
        Login_Error = 0

    While Login_Error < 3
    If txtPassword.Text <> "1234" Then
        Select Case var1
        Case Is <= 3
        MsgBox "The password is incorrect", vbExclamation, "INCORRECT PASSWORD"
        var1 = var1 + 1
        Case Else
        MsgBox "You have entered the wrong password too many times,the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
        Unload Me
        End Select
        Else
        frmWelcome.Hide
        'frmSplash.Show
        Login_Error = Login_Error + 1
    End If
    End While
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 03:43PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month