Tuesday, August 4, 2015

Right Click Event VB.net


Hey welcome back for more one tutorial. Today I will show a simple code to create a Right Click Event.

As you can see, there is no an "automatic" Right Click Event so, when you want to make it you have to use other methods. I will present the most simple.

1- Open your Visual Studio
2- Create a project in VB.net
3- Add for exemple a button or any other control than you want

Now let´s go to the code. This code contains 2 steps. 
4.1- Create a Mouse_Up Event
4.2- Detects if when the user click in the button, he used the right button of the mouse.

So, double-click in the button (or just open the form1.vb file). Create the Mouse_Up Event
Paste the following code:

If e.Button = MouseButtons.Right Then
            MsgBox("Right Click :D")
        End If  

No comments:

Post a Comment