program not clearing last mouseclick, maybe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • remma
    New Member
    • Feb 2009
    • 1

    program not clearing last mouseclick, maybe

    Hi, I'm having a bit of a problem and am starting to tear my hair out!

    I have this sub

    Code:
        Private Sub mainTXT1_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mainTXT1.MouseDown, mainTXT2.MouseDown
    
            txtclicked = sender.Name
            whereami()
    
        End Sub
    which handles the mousedown event on a bunch of 16 labels (I've trimmed it somewhat for brevity).
    I've set it up this way so that I can reuse it at various points in the code, triggering different events each time.
    Now the first time this code executes is fine, the label acts just like a button really and does exactly what it's supposed to do on the first click.
    The problem is the second and subsequent times I come to use this code I have to click twice to get the click to register. (I've also tried this with buttons and get the same result)

    Is there some way to clear/reset the mousedown event or mark it as handled to stop this from happening?
Working...