Add a Popup Menu to form with existing menu

Posted on 2005-04-13
Medium Priority
Last Modified: 2012-05-05
I used menu editor to create a drop down menu across the top of one of my forms.  The menu is similar to:

File        Edit     Help

Save      Cut      Version
New      Paste    About
Open     Copy

I now want to add a popup menu to the form which shows when the user right clicks while some of the controls have focus.  How do I add the popup menu.  Every time I enter the menu editor for the form I see the existing menu but I want to create a totally new one.

Question by:mlcktmguy
  • 2

Accepted Solution

rdwillett earned 500 total points
ID: 13778872
On the same menu editor create your new popup menu and uncheck the visible box

On click or mousedown and or mouseup and button =2 add:
PopupMenu YourRightClick Menu Name

Create a new Main Menu Item:
Caption: Right Click  Name: mnuRightClick
Uncheck the Visible Box (in other words, it will not be visible in the main menu that appears on form)
Add SubMenu Items
Caption: Copy Name: mnuRCCopy
Caption: Edit   Name: mnuRCEdit

Example Code

Private Sub Text1_Click(Index As Integer)
    If Button = 2 Then PopupMenu mnuRightClick
End Sub

Author Comment

ID: 13783015
The instructions to build the menu are right on but the code to recognize the click doesn't seem to work.

The click events on my textbox does not have the (Index as integer)  parameter.  When i add it the compiler objects.

Author Comment

ID: 13783891
diregard last post, I found the Button and other variables in the mouse down event.

Thanks for the help.  You get the points

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question