Counter of login attempts?how to lock a system login after 3 failed attempts in vb6?Login page creating through Android EclipseHow to create a login page as always be logged in if once logged in?How to remove login page SugarCRMCrystal Reports 8 Issues From SQL 7 To SQL 2008 VB6PHP login page without databaseVariable iterating on itself - different behavior with different typeshow do i make login with session in laravel 5.4Login page is not working after uploading it to an online serverLogin page does not find the password

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

How to make a list of partial sums using forEach

How to preserve electronics (computers, iPads and phones) for hundreds of years

Pre-Employment Background Check With Consent For Future Checks

If Captain Marvel (MCU) were to have a child with a human male, would the child be human or Kree?

Should I assume I have passed probation?

Sigmoid with a slope but no asymptotes?

Typing CO_2 easily

Ways of geometrical multiplication

How to get directions in deep space?

How to write Quadratic equation with negative coefficient

How do you justify more code being written by following clean code practices?

Confusion over Hunter with Crossbow Expert and Giant Killer

Why the "ls" command is showing the permissions of files in a FAT32 partition?

How can ruler support inventing of useful things?

How to leave product feedback on macOS?

Is there a RAID 0 Equivalent for RAM?

Deciphering cause of death?

Why would five hundred and five be same as one?

Review your own paper in Mathematics

What is the meaning of "You've never met a graph you didn't like?"

How to understand "he realized a split second too late was also a mistake"

Is there a reason to prefer HFS+ over APFS for disk images in High Sierra and/or Mojave?

Proving an identity involving cross products and coplanar vectors



Counter of login attempts?


how to lock a system login after 3 failed attempts in vb6?Login page creating through Android EclipseHow to create a login page as always be logged in if once logged in?How to remove login page SugarCRMCrystal Reports 8 Issues From SQL 7 To SQL 2008 VB6PHP login page without databaseVariable iterating on itself - different behavior with different typeshow do i make login with session in laravel 5.4Login page is not working after uploading it to an online serverLogin page does not find the password













0















I am designing a login page in visual basics 6.0. I have to include a counter such that after three unsuccessful attempts the page will close itself. I have written following code in command button. Although there is no errors but the counter is not working. Here is the code:



Private Sub Command1_Click()
Dim count As Integer
count = 0

If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1
If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub









share|improve this question



















  • 1





    Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

    – Idle_Mind
    Mar 7 at 22:01







  • 1





    @Idle_Mind You're right, I'd shifted my parameters over :-)

    – ItsPete
    Mar 7 at 22:08















0















I am designing a login page in visual basics 6.0. I have to include a counter such that after three unsuccessful attempts the page will close itself. I have written following code in command button. Although there is no errors but the counter is not working. Here is the code:



Private Sub Command1_Click()
Dim count As Integer
count = 0

If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1
If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub









share|improve this question



















  • 1





    Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

    – Idle_Mind
    Mar 7 at 22:01







  • 1





    @Idle_Mind You're right, I'd shifted my parameters over :-)

    – ItsPete
    Mar 7 at 22:08













0












0








0








I am designing a login page in visual basics 6.0. I have to include a counter such that after three unsuccessful attempts the page will close itself. I have written following code in command button. Although there is no errors but the counter is not working. Here is the code:



Private Sub Command1_Click()
Dim count As Integer
count = 0

If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1
If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub









share|improve this question
















I am designing a login page in visual basics 6.0. I have to include a counter such that after three unsuccessful attempts the page will close itself. I have written following code in command button. Although there is no errors but the counter is not working. Here is the code:



Private Sub Command1_Click()
Dim count As Integer
count = 0

If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1
If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub






vb6 login-page






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 12:15









DaveInCaz

3,32532041




3,32532041










asked Mar 7 at 21:51









J. AndersonJ. Anderson

122




122







  • 1





    Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

    – Idle_Mind
    Mar 7 at 22:01







  • 1





    @Idle_Mind You're right, I'd shifted my parameters over :-)

    – ItsPete
    Mar 7 at 22:08












  • 1





    Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

    – Idle_Mind
    Mar 7 at 22:01







  • 1





    @Idle_Mind You're right, I'd shifted my parameters over :-)

    – ItsPete
    Mar 7 at 22:08







1




1





Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

– Idle_Mind
Mar 7 at 22:01






Just change Dim to Static so it keeps its value across calls; and get rid of the line that sets it to zero.

– Idle_Mind
Mar 7 at 22:01





1




1





@Idle_Mind You're right, I'd shifted my parameters over :-)

– ItsPete
Mar 7 at 22:08





@Idle_Mind You're right, I'd shifted my parameters over :-)

– ItsPete
Mar 7 at 22:08












2 Answers
2






active

oldest

votes


















2














Just change Dim to Static so it keeps its value across calls. And also get rid of the line that sets it to zero:



Private Sub Command1_Click()
Static count As Integer

If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1
If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub





share|improve this answer























  • Thank You, It worked.

    – J. Anderson
    Mar 7 at 22:34


















1














You set your count to 0 each time that Command1 is clicked. You need to declare count outside of that sub & initialise it to 0 elsewhere.



Private count As Integer

Private Sub Command1_Click()
If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
Else
count = count + 1

If count = 3 Then
End
Else
MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text1.SetFocus
End If
End If
End Sub





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053363%2fcounter-of-login-attempts%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Just change Dim to Static so it keeps its value across calls. And also get rid of the line that sets it to zero:



    Private Sub Command1_Click()
    Static count As Integer

    If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
    MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
    Else
    count = count + 1
    If count = 3 Then
    End
    Else
    MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
    Form1.Text1 = ""
    Form1.Text2 = ""
    Form1.Text1.SetFocus
    End If
    End If
    End Sub





    share|improve this answer























    • Thank You, It worked.

      – J. Anderson
      Mar 7 at 22:34















    2














    Just change Dim to Static so it keeps its value across calls. And also get rid of the line that sets it to zero:



    Private Sub Command1_Click()
    Static count As Integer

    If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
    MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
    Else
    count = count + 1
    If count = 3 Then
    End
    Else
    MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
    Form1.Text1 = ""
    Form1.Text2 = ""
    Form1.Text1.SetFocus
    End If
    End If
    End Sub





    share|improve this answer























    • Thank You, It worked.

      – J. Anderson
      Mar 7 at 22:34













    2












    2








    2







    Just change Dim to Static so it keeps its value across calls. And also get rid of the line that sets it to zero:



    Private Sub Command1_Click()
    Static count As Integer

    If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
    MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
    Else
    count = count + 1
    If count = 3 Then
    End
    Else
    MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
    Form1.Text1 = ""
    Form1.Text2 = ""
    Form1.Text1.SetFocus
    End If
    End If
    End Sub





    share|improve this answer













    Just change Dim to Static so it keeps its value across calls. And also get rid of the line that sets it to zero:



    Private Sub Command1_Click()
    Static count As Integer

    If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
    MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
    Else
    count = count + 1
    If count = 3 Then
    End
    Else
    MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
    Form1.Text1 = ""
    Form1.Text2 = ""
    Form1.Text1.SetFocus
    End If
    End If
    End Sub






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 7 at 22:04









    Idle_MindIdle_Mind

    23.7k21424




    23.7k21424












    • Thank You, It worked.

      – J. Anderson
      Mar 7 at 22:34

















    • Thank You, It worked.

      – J. Anderson
      Mar 7 at 22:34
















    Thank You, It worked.

    – J. Anderson
    Mar 7 at 22:34





    Thank You, It worked.

    – J. Anderson
    Mar 7 at 22:34













    1














    You set your count to 0 each time that Command1 is clicked. You need to declare count outside of that sub & initialise it to 0 elsewhere.



    Private count As Integer

    Private Sub Command1_Click()
    If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
    MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
    Else
    count = count + 1

    If count = 3 Then
    End
    Else
    MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
    Form1.Text1 = ""
    Form1.Text2 = ""
    Form1.Text1.SetFocus
    End If
    End If
    End Sub





    share|improve this answer





























      1














      You set your count to 0 each time that Command1 is clicked. You need to declare count outside of that sub & initialise it to 0 elsewhere.



      Private count As Integer

      Private Sub Command1_Click()
      If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
      MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
      Else
      count = count + 1

      If count = 3 Then
      End
      Else
      MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
      Form1.Text1 = ""
      Form1.Text2 = ""
      Form1.Text1.SetFocus
      End If
      End If
      End Sub





      share|improve this answer



























        1












        1








        1







        You set your count to 0 each time that Command1 is clicked. You need to declare count outside of that sub & initialise it to 0 elsewhere.



        Private count As Integer

        Private Sub Command1_Click()
        If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
        MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
        Else
        count = count + 1

        If count = 3 Then
        End
        Else
        MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
        Form1.Text1 = ""
        Form1.Text2 = ""
        Form1.Text1.SetFocus
        End If
        End If
        End Sub





        share|improve this answer















        You set your count to 0 each time that Command1 is clicked. You need to declare count outside of that sub & initialise it to 0 elsewhere.



        Private count As Integer

        Private Sub Command1_Click()
        If Form1.Text1 = "admin" And Form1.Text2 = "admin" Then
        MsgBox "Login Succesfull", vbOKOnly + vbInformation, "Welcome"
        Else
        count = count + 1

        If count = 3 Then
        End
        Else
        MsgBox "Login Unsuccesfull", vbOKOnly + vbCritical, "Try Again"
        Form1.Text1 = ""
        Form1.Text2 = ""
        Form1.Text1.SetFocus
        End If
        End If
        End Sub






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 7 at 22:06

























        answered Mar 7 at 21:59









        ItsPeteItsPete

        8801026




        8801026



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053363%2fcounter-of-login-attempts%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme