While Visual Basic provides an easy way to create shortcut menus, some controls
such as rich text boxes don't inherently support pop-up menus. To overcome this
obstacle, you can take advantage of the MouseDown() event. Visual Basic triggers
this event when you press the mouse button. To provide a pop-up menu, create
a
shortcut menu, then simply call it in the control's MouseDown() event.
To see how this works, add a Rich Textbox control to a sample form. Next, select
Tools | Menu Editor from Visual Basic's IDE menu bar, and create a simple menu
with one or two items. Then, switch to the form's code window, and enter
Private Sub RichTextBox1_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Me.PopupMenu Menu
End IF
End Sub