Creating Submenus During Run Time

Creating Submenus During Run Time

I’m trying to create a drop-down sub menu in a VB form. I’ve tried almost every applicable API32 call and have not been able to do it.

If you are simply trying to create a menu with a subitem you can do so in the Menu Editor; creating a top level menu and indenting, then adding the next menu item.

If you are trying to create a context menu (a menu that appears on a right click event), you can create a regular menu and submenu as described above, then, on the MouseDown event of the form check if the right mouse button is pressed down and call the Form’s PopupMenu method followed by the name of the top-level menu.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist