Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Discovering the VB Menu Hierarchy at Runtime

Status
Not open for further replies.

BlackburnKL

Programmer
Oct 21, 2002
196
US
I need to be able to hide (.Visible = False) selected menu options on a VB form at runtime. I am able to do so (using the Controls collection), with one exception. If I attempt to hide the last visible item on a menu, VB returns an Error 387 because you can't have a menu with no items on it.

I know it doesn't make sense to have a menu with no items, so I would like to be able to disable the menu itself (the parent that now has no items. However, I have been unable to locate a method (even using an API) to programatically determine which menu item is the parent of another. I understand that standard naming conventions would help in this regard, but I am in an environment where I cannot count on a naming convention to accomplish what I need to do.

Can anybody tell me how to discover the menu hierarchy at runtime so that I can find the parent to the last hidden menu item on a menu?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top