Working with Menu Items
When a top-level menu is in place, you can start adding submenus or items to it. You create submenus by using the same process you use to add items to a main menu. After creating submenus, you can worry about their various visual decorations such as separator lines and check marks.
Adding Submenus
To demonstrate how to add submenus, in this section we will expand on the File menu from the previous section. To add the contents of the File menu, you need to add a few new items to the MenuItems collection of the file menu:
With appMenu fileMenu = .MenuItems.Add("&File") fileMenu.MenuItems.Add("&Open...") fileMenu.MenuItems.Add("&Save") fileMenu.MenuItems.Add("Save As...") fileMenu.MenuItems.Add("View As Web Pa&ge") fileMenu.MenuItems.Add("&Close") ...
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.