Solved

Creating VB Menus with code

Posted on 2002-06-30
6
140 Views
Last Modified: 2010-05-02
Hello experts:

Id like to create a vb menu using code.  The data elements would be pulled from a database table.  I'm very comfortable with ado connectivity, just don't know how to create the menu.

Could anyone provide an example?

Thanks

E
0
Comment
Question by:escheider
  • 2
  • 2
  • 2
6 Comments
 
LVL 1

Expert Comment

by:alfanhendro
ID: 7120985
not sure whether it works on menu, but i used this for labels, list, etc.

Create the Menu as control array from the interface.
(one menu item is enough)
when you need to create a new one, just load it.
eg.
assuming the one created in the interface is has Index = 0

IndexCtr = IndexCtr + 1
Load mnuItem(IndexCtr)
mnuItem(IndexCtr).Visible = True
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 7121216
Alternatively you can done this also by using APIs:

http://www.allapi.net/apilist/apifunction.php?apifunction=CreatePopupMenu
0
 
LVL 4

Author Comment

by:escheider
ID: 7121834
alfan:

So I have to create at least one entry using the Menu Editor in order to use code?  And the initial entry I create should initiate the control array?

So lets say i want to create a menu called Reports.  I create the Heading (Reports), then create the first entry under Reports?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 51

Accepted Solution

by:
Ryan Chong earned 25 total points
ID: 7123890
Yes, you should use the Menu Editor to at least at an initiate control array menu.

First, create a Menu Parent for the control array menu, let say mMenu. Then under this mMenu, add an initiate control array menu by naming it as mReports, set its Index Property to 0 to indicate it's a member of Reports.

Then populate the mReports as get the elements from database. And at last, popup the menu to show the mReports by using PopupMenu mMenu.

cheers
0
 
LVL 1

Expert Comment

by:alfanhendro
ID: 7124314
exactly.
(point goes to ryancys if it helps)
0
 
LVL 4

Author Comment

by:escheider
ID: 7132449
Works like a champ.  I appreciate both of your help and have awarded ryancy's the points because alfanhendro said to do so.

Thanks

Escheider
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 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