Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

Use vb6 code to add items to the menu

I have a VB6 form.

I added a menu to it, that has a heading "File"  How can I use code to add something to the dropdown menu?

For example, if var1 = "Item1"

Then the VB Menu should say File > Item1

Is there a way to have VB code create the items for File on my menu?
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

This will tell you everything you need to know.
Do we have a bit of a language problem here? If you are having a form anything you put into it is a "Control". There are different types of controls that you can select from the Toolbox. One of them is a ComboBox which would have a drop-down list (not a "menu"). You can add items to that list by using the the Add method of the Control's object. You may find some guidance at this link, http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/c7a82a6a-763e-424b-84e0-496caa9cfb4d/ or simply google "Add item to Combobox". Avoid the word "menu". Microsoft uses the drop-down technology to create menus and you can do that, too. But what you use to create your menu is a "list".
To avoid the pitfalls of wrong nomenclature you might post your workbook with the form to better explain the question.
Avatar of al4629740

ASKER

Ouch.  Sorry I asked the question.

In any case, I attached a picture of what I'm "trying" to do as a novice programmer.

Note that where it is highlighted on the form, I would like to populate the menu item under File
sample.docx
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're welcome and I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012