98 Part I Getting Started with Microsoft Visual Basic 2010
selections and make the commands perform useful work. In the following exercise, you’ll
take your first steps with this process by using the MenuStrip control to create a Clock menu
containing commands that display the current date and time.
Create a menu
- Start Visual Studio.
- On the File menu, click New Project.
The New Project dialog box opens.
- Create a new Windows Forms Application project named MyMenu.
- Click the MenuStrip control on the Menus & Toolbars tab of the Toolbox, and then
draw a menu control on your form.
Don’t worry about the location—Visual Studio will move the control and resize it
automatically. Your form looks like the one shown here:
The menu strip object doesn’t appear on your form, but below it. Non-visible objects,
such as menus and timers, are displayed in the Integrated Development Environment
(IDE) in a separate pane named the component tray, and you can select them, set their
properties, or delete them from this pane.
In addition to the menu strip object in the component tray, Visual Studio displays a visual
representation of the menu that you created at the top of the form. The Type Here tag
encourages you to click the tag and enter the title of your menu. After you enter the first
menu title, you can enter submenu titles and other menu names by pressing the ARROW
keys and typing additional names. Best of all, you can come back to this in-line Menu