Right click event

Hi all,

it appears that the only way to create a right-click event in VB.NET is by creating a context-sensitive menu. What if you wanted something else to happen when you right-click? Something other than a menu popping up? Is there a way to create a right-click event without the context sensitive menu?




  • Hi,
    Normally whenever u right click the context menu pops up and shows u the options. That's just the way it was designed and its not mandatory to associate a right click always to the context menu.

    U can write code in the menu click, to perform other operations whenever u right click on the form. Try the following code..

    (Just paste the event in the form and right click on the form on runtime).

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
    If e.Button = MouseButtons.Right Then
    MessageBox.Show("Hi. I am John.")
    End If
    End Sub

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion