PopupMenu Method Example

The example displays a pop-up menu at the cursor location when the user clicks the right mouse button over a form.  To try this example, create a form with a menu named "mnuFile" ("mnuFile" must have at least one submenu).  Copy the code into the Declarations section of the form and press F5.

Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 2 Then
    PopupMenu mnuFile
  End If
End Sub