Chapter 9. Creating Menus

Menus are a part of every good application and provide not only an easy way to navigate within an application but also useful tools for working with that application. Take, for example, Visual Studio 2008. It provides menus for navigating the various windows that it displays and useful tools for making the job of development easier through menus and context menus (also called pop-up menus) for cutting, copying, and pasting code. It also provides menu items for searching through code.

This chapter takes a look at creating menus in your Visual Basic 2008 applications. You explore how to create and manage menus and submenus and how to create context menus and override the default context menus. Visual Studio 2008 provides two menu controls in the Toolbox, and you explore both of these.

In this chapter, you will:

  • Create menus

  • Create submenus

  • Create context menus

Understanding Menu Features

The MenuStrip control in Visual Studio 2008 provides several key features. First and foremost, it provides a quick and easy way to add menus, menu items, and submenu items to your application. It also provides a built-in editor that allows you to add, edit, and delete menu items at the drop of a hat.

The menu items that you create may contain images, access keys, shortcut keys, and check marks as well as text labels.

Images

Everyone has seen images on the menus in applications such as Microsoft Outlook or Visual Studio 2008. In earlier versions of Visual Basic, developers were unable ...

Get Beginning Microsoft® Visual Basic® 2008 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.