Working with Menus

VB6 had cobbled support for menus. Menus were managed through the IDE's menu editor. Menus were not full-fledged components, controllable at runtime. Visual Basic .NET introduces the MainMenu and ContextMenu components.

These two components come replete with design-time and runtime capabilities. You can easily add menu items at design time using the menu editors, and at runtime using the methods and properties of these two subclasses of the Menu component.

I will briefly describe how to use the redefined Menu Designer and proceed to the technical steps for programmatically adding menu items at runtime.

Defining a MainMenu or ContextMenu

Most of the steps for implementing either MainMenu or ContextMenu are identical. I will ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.