BlackburnKL
Programmer
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?
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?