Creating Menus

Like forms, menus are objects in their own right in the .NET Framework. When you set out to create menus for an application, you are either creating a main menu that appears below the title bar, or you are creating a context menu that is displayed when the user right-clicks over an area of the form. (Context menus are often called pop-up menus.) Menus have become an established part of user interface design. This section covers the menu-related classes in the .NET Framework and shows you how to imbue your forms with menu-based functionality.

Adding a Main Menu to a Form

Before you associate a main menu with a form, you first have to create an object instance of the menu. The code to do this is straightforward:

 Dim appMenu As MainMenu ...

Get Visual Basic® Programmer's Guide to the .NET Framework Class Library 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.