Solved

Creating VB Menus with code

Posted on 2002-06-30
6
134 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 49

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now