Menu Bar and Toolbar
Commands for managing the IDE and for developing, maintaining and executing programs are contained in menus, which are located on the menu bar of the IDE (Fig. 2.7). Note that the set of menus displayed in Fig. 2.7 changes based on what you are currently doing in the IDE.
Figure 2.7. Visual Studio menu bar.
Menus contain groups of related commands (also called menu items) that, when selected, cause the IDE to perform specific actions (e.g., open a window, save a file, print a file and execute a program). For example, new projects can be created by selecting File > New Project.... The menus depicted in Fig. 2.7 are summarized in Fig. 2.8. In Chapter 14, Graphical User Interface Concepts: Part 2, we discuss how to create and add your own menus and menu items to your programs.
Menu |
Description |
---|---|
File |
Contains commands for opening, closing, adding and saving projects, as well as printing project data and exiting Visual Studio. |
Edit |
Contains commands for editing programs, such as cut, copy, paste, undo, redo, delete, find and select. |
View |
Contains commands for displaying windows (e.g., Solution Explorer, Toolbox, Properties window) and for adding toolbars to the IDE. |
Project |
Contains commands for managing projects and their files. |
Build |
Contains commands for compiling a program. |
Debug |
Contains commands for debugging (i.e., identifying and correcting problems in a program) and running a program. Debugging is discussed in detail in Appendix C. |
Data |
Contains commands for interacting with databases (i.e., organized collections of data stored on computers), which we discuss in Chapter 20, Database, SQL and ADO.NET). |
Format |
Contains commands for arranging and modifying a form's controls. Note that the Format menu appears only when a GUI component is selected in Design view. |
Tools |
Contains commands for accessing additional IDE tools (e.g., the Toolbox) and options that enable you to customize the IDE. |
Window |
Contains commands for arranging and displaying windows. |
Community |
Contains commands for sending questions directly to Microsoft, checking question status, sending feedback on Visual C# and searching the CodeZone developer center and the Microsoft developers community site. |
Help |
Contains commands for accessing the IDE's help features. |
Rather than navigating the menus from the menu bar, you can access many of the more common commands from the toolbar (Fig. 2.9), which contains graphics, called icons, that graphically represent commands. [Note: Figure 2.9 divides the toolbar into two parts so that we can illustrate the graphics more clearlythe toolbar appears on one line inside the IDE.] By default, the standard toolbar is displayed when you run Visual Studio for the first time; it contains icons for the most commonly used commands, such as opening a file, adding an item to a project, saving and running (Fig. 2.9). Some commands are initially disabled (i.e., unavailable to use). These commands, which are initially grayed out, are enabled by Visual Studio only when they are necessary. For example, Visual Studio enables the command for saving a file once you begin editing the file.
Figure 2.9. Standard toolbar in Visual Studio.
(This item is displayed on page 44 in the print version)
a)
b)
You can customize the IDE by adding more toolbars. Select View > Toolbars (Fig. 2.10). Each toolbar you select will be displayed with the other toolbars at the top of the Visual Studio window (Fig. 2.10). Another way in which you can add toolbars to your IDE (which we do not show in this chapter) is through selecting Tools > Customize. Then, under the Toolbars tab, select the additional toolbars you would like to have appear in the IDE.
Figure 2.10. Adding the Build toolbar to the IDE.
(This item is displayed on page 44 in the print version)
To execute a command via the toolbar, click its icon. Some icons contain a down arrow that, when clicked, displays a related command or commands, as shown in Fig. 2.11.
Figure 2.11. IDE toolbar icon showing additional commands.
It is difficult to remember what each of the icons on the toolbar represents. Positioning the mouse pointer over an icon highlights it and, after a brief delay, displays a description of the icon called a tool tip (Fig. 2.12). Tool tips help novice programmers become familiar with the IDE's features and serve as useful reminders of each toolbar icon's functionality.
Figure 2.12. Tool tip demonstration.