Results 1 to 4 of 4

Thread: 1st mouse click does not fire

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    15

    1st mouse click does not fire

    I have been working with VB for about five years. I am not a newbie, but I am not an expert either.

    I have a simple program. It has a "Start" and an "Exit" button. When the "START" button is hit, I change the text on the exit button to read "STOP PROCESSING". Then I go into my processing loop.

    When the "STOP PROCESSING" button is clicked the first time, the program simply ignores it. When I click it the SECOND time, it gets control. I know this because I put a breakpoint in at the start of the subroutine.

    What could I possibly be doing to quash the firing the first time? Any ideas? Has anyone ever experience this kind of thing?

    Thanks in advance
    Dave

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: 1st mouse click does not fire

    If you're setting the Button Text to "Stop Processing" then presumably you are doing some processing. If you don't do that processing, does it still behave the same way?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: 1st mouse click does not fire

    Can you show us what "processing" you are doing?

  4. #4
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: 1st mouse click does not fire

    Could you post the code for the start button .click event?

    A quick something to try, when you start the loop include a boolean value such as:

    vbnet Code:
    1. Dim loopstarted as boolean = false
    2.  
    3. Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    4.  
    5. IF loopstarted = False then
    6. loopstarted = True
    7. 'Start loop here including something like "Do until loopstarted = false"
    8. Else
    9. loopstarted = False
    10. End IF
    11.  
    12. End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width