No double click event? No problem

Use this board to post your code snippets - tips and tricks
1 post Page 1 of 1
Contributors
User avatar
Bloodz_Ninja
Dedicated Member
Dedicated Member
Posts: 69
Joined: Sat Aug 25, 2012 3:20 am

Once again, back with a very simple code.
In a project of mines, i have a hidden feature that is triggered by double clicking on an object. But visual studio 2010 doesnt have a double click event... not that i know of atleast
So here is my solution

What we need:
An object to click on
Timer
Variable

For the variable, we called it click. Declared as an integer
And the timer is set to 500 or 1000 intervals

So on the objects click event, enter this
Code: Select all
click += 1
        If click = 1 Then
            doubleClick.Start()
        End If

       If click = 2 Then
            'add event here
            Else
                'Nothing
            End If
            click = 0
            doubleClick.Stop()
        End If

doubleClick.Start() being the timer

In the timer, add
Code: Select all
click = 0
            doubleClick.Stop()
So depending on how fast your timer intervals are, is how fast they need to double click. If timer is set to 1000 intervals, they have 1 second to click twice. if the timer ticks, it wont work.
1 post Page 1 of 1
Return to “Quick Snips”