JavaScript Editor Javascript validator     Javascripts

Main Page

Previous Section Next Section

2.3 The Integrated Development Environment (IDE)

The Visual Studio .NET integrated development environment (IDE) consists of windows for visual design of forms, code-editing windows, menus and toolbars providing access to commands and features, toolboxes containing controls for use on the forms, and windows providing properties and information about forms, controls, projects, and the solution.

2.3.1 Layout

Visual Studio .NET is a multiple document interface (MDI) application. It consists of a single parent window, which contains multiple windows. All the menus, toolbars, design and editing windows, and miscellaneous other windows are associated with the single parent window.

A typical layout of the IDE is shown in Figure 2-3. This section discusses the overall layout and many of the features that make working with the IDE so productive.

Figure 2-3. Typical IDE layout

The Visual Studio .NET window has a title bar across the top with menus below. Under the menus are toolbars with buttons that duplicate many of the common menu commands. Nearly everything that can be done through menus can also be done with context-sensitive pop-up menus, as described in the discussion that follows. The menu and toolbars are easily customized by clicking on Tools Customize.

The toolbars are docked along the top of the window by default. As with many Windows applications, they can be undocked and moved to other locations, either free-floating or docked along other window edges. You move the toolbars by grabbing them with the mouse and dragging them where you want.

Figure 2-3 shows a design view of a web form, with the design window occupying the main area in the center of the screen. This allows for visual design by dragging and dropping components from the Toolbox along the left side of the screen.

Along the right side of the screen are two windows, both of which will be covered in more detail later in this chapter. The upper window is the Solution Explorer. Below that is the Properties window. There are many other similar windows available to you, as will be described.

All of these windows, plus the Toolbox, are resizable and dockable. They can be resized by placing the mouse cursor over the edge you want to move. The cursor will change to a double-arrow resizing cursor, at which point you can drag the window edge one way or the other.

Right-clicking on the title bar of a dockable window pops up a menu with four mutually exclusive check items:


The window can be dragged and docked along any side of the Visual Studio .NET window.


The window disappears. To see the window again (i.e., to unhide it), use the View main menu item.


The window will not dock when dragged against the edge of the Visual Studio .NET window. The floating window can be placed anywhere on the desktop, even outside the Visual Studio .NET window.

You can also double-click on either the title bar or the tab to dock and undock the window. Double-clicking on the title while docked undocks the entire group. Double-clicking on the tab just undocks the one window, leaving the rest of the group docked.

Auto Hide

The window will disappear, indicated only by a tab, when the cursor is not over the window. It will reappear when the cursor is over the tab. A pushpin in the upper right corner of the window will be pointing down when Auto Hide is turned off and pointing sideways when it is turned on.

In the upper-right corner of the window are two icons:


This icon toggles the AutoHide property of the window.

When the pushpin is pointing down, the window is pinned in place; AutoHide is turned off. Moving the cursor off the window will not affect its visibility.

When the pushpin is pointing sideways, AutoHide is turned on. Moving the cursor off the window hides the window. To see the window again, click on the tab, which is now visible along the edge where the window had been docked.


Standard close window icon.

The main design window uses a tabbed metaphor (i.e., the tabs along the top edge of that window indicate there are other windows below it). You can change to an MDI style, if you prefer, in Tools Options. Clicking on the tab labeled WebForm1.aspx.cs in Figure 2-3, for example, will bring up the screen shown in Figure 2-4, which contains a code window.

Figure 2-4. Code window in IDE

When you switch from a design window to a code window, the menu items, toolbars, and toolbox change in a context-sensitive manner.

The code window has drop-down lists at the top of the screen for navigating around the application. The left drop-down contains a list of all the classes in the code and the right drop-down has a list of all the objects in the current class. In VB.NET you can also use these drop-downs to select event sources (from the lefthand drop-down) and add event handlers (from the righthand drop-down). This also works in the HTML editor.

Along the bottom edge of the IDE window is a status bar, which shows such information as the current cursor position (when a code window is visible), the status of the Insert key, and any pending shortcut key combinations.

2.3.2 Menus and Toolbars

The menus provide access to many of the commands and capabilities of Visual Studio .NET. The more commonly used menu commands are duplicated with toolbar buttons for ease of use.

The menus and toolbars are context-sensitive (i.e., the available selection is dependent on what part of the IDE is currently selected, and what activities are expected or allowed). For example, if the current active window is a code-editing window, the top-level menu commands are:


If the current window is a design window, then the Data, Format, Table, Insert, and Frames menu commands also become available, for example.

The following sections describe some of the menu items and their submenus, focusing on those aspects that are interesting and different from common Windows commands.

2.3.3 File Menu

The File menu provides access to a number of file, project, and solution-related commands. Many of these commands are content sensitive. Below are descriptions of those commands that are not self-explanatory. New

As in most Windows applications, the New menu item creates new items to be worked on by the application. In Visual Studio .NET, the New menu item has three submenu items, to handle the different possibilities. They are:

Project . . . (Ctrl+Shift+N)

The Project command brings up the New Project dialog, which is context-sensitive. If there is no project currently open, as is sometimes the case when Visual Studio .NET is just opened, you will see the dialog box shown in Figure 2-2.

If there is already a project open, then you will get the New Project dialog box shown in Figure 2-5. This dialog box adds radio buttons to give you the choice of adding the new project to the solution, or closing the existing solution and creating a new one to hold the new project.

Figure 2-5. New Project dialog box from menu

Notice the two image buttons at the top right of the dialog box: these allow you to display the templates in either large or small icons.

File . . . (Ctrl+N)

The File command brings up a New File dialog box, as shown in Figure 2-6. It offers three different categories of files and many different types of files (templates) within each category. Files created this way are located by default in the project directory (although you can browse for a different location). They are displayed in the Solution Explorer if the Show All button is toggled, but they are not actually part of the solution unless explicitly added by using one of the Add menu items described later in this chapter. In other words, they are the miscellaneous files described previously in the section, "Projects and Solutions."

Figure 2-6. New File dialog box
Blank Solution . . .

The Blank Solution command also brings up a New Project dialog similar to that shown in Figure 2-5, with the Add to Solution radio button grayed out, the default Project Type set to Visual Studio Solutions, and the Template set to Blank Solution. When a blank solution is created, it contains no items. Items can be added using one of the Add menu items described later in this section.

The New command has an equivalent button in the Standard toolbar, which exposes the New Project and Blank Solution commands. Open

The Open menu item is used to open preexisting items. It has four submenu items:

Project . . . (Ctrl+Shift+O)

Opens a previously existing project. The currently opened solution is closed before the new project is opened.

Project From Web . . .

An Open Project From Web dialog box is presented, which accepts a URL pointing to the project to open. As with Open Project, the currently opened solution is closed before the new project is opened.

File . . . (Ctrl+O)

Presents a standard Open File dialog box, allowing you to browse to and open any file accessible on your network. Files opened are visible and editable in Visual Studio .NET, but are not part of the project. To make a file part of the project, use one of the Add menu commands described later in this chapter. The Open File command has an equivalent button on the Standard toolbar.

File From Web . . .

An Open File From Web dialog box is presented which accepts a URL pointing to the file to open. As with Open File, the file selected is not made part of the project. Add New Item . . . (Ctrl+Shift+A)

Add New Item allows you to add a new item to the current project. It presents the Add New Item dialog box shown in Figure 2-7. Expanding the nodes in the Categories pane on the left side of the dialog box narrows the list of Templates shown on the right side.

Figure 2-7. Add New Item dialog box

This is the menu item to use if you want to add new files to your project, including new source code files. For source code, you would typically add a new Class file, which will automatically have the language-specific filename extension.

This command has an equivalent button in the Standard toolbar. It is also accessible from the context menu in the Solution Explorer. Add Existing Item . . . (Shift+Alt+A)

Add Existing Item is very similar to the Add New Item menu item just described, except that it adds already existing items to the current project. If the item added resides outside the project directory, a copy is made and placed in the project directory.

This menu option is also available from the context menus in the Solution Explorer. Add Project

Add Project has three submenus. The first two, New Project and Existing Project, allows you to add either a new or preexisting project to the solution. The third, Existing Project From Web, presents a dialog box that accepts the URL of the project to be added. Open Solution

Clicking on this menu item brings up the Open Solution dialog box, which allows you to browse for the solution to open. The currently open solution will be closed before the new solution is opened. Close Solution

This menu item is only available if there a solution is currently open. If this menu item is selected, the currently open solution will be closed. Advanced Save Options . . .

Advanced Save Options is a context-sensitive submenu that is only visible when editing in a code window. It presents a dialog box, which allows you to set the encoding option and line ending character(s) for the file. Source Control

The Source Control submenu item allows you to interact with your source control program.

2.3.4 Edit Menu

The Edit menu contains the text editing and searching commands that one would expect, but also includes commands useful in editing code. The most useful are: Cycle Clipboard Ring (Ctrl+Shift+V)

The Clipboard Ring is like copy-and-paste on steroids. Copy a number of different selections to the Windows clipboard, using the Edit Cut (Ctrl X) or Edit Copy (Ctrl+C) commands. Then use Ctrl+Shift+V to cycle through all the selections, allowing you to paste the correct one when it comes around. You can also see the whole clipboard ring in the Toolbox (it's one of the panes that is visible when you're editing a text file).

This submenu item is context-sensitive and is visible only when editing a code window. Find and Replace/ Find in Files (Ctrl+Shift+F)

Find in Files is a very powerful search utility that finds text strings anywhere in a directory or in subdirectories (subfolders). It presents the dialog box shown in Figure 2-8. Checkboxes present several self-explanatory options, including the ability to search using either wildcards or regular expressions.

Figure 2-8. Find in Files dialog box

If you click on the Replace button in the Find in Files dialog box, you will get the Replace in Files dialog box shown in Figure 2-9 and described next.

Figure 2-9. Replace in Files dialog box

Regular Expressions

Regular expressions are a language unto themselves, expressly designed for incredibly powerful and sophisticated searches. A full explanation of regular expressions is beyond the scope of this book. For a complete discussion of regular expressions, see the SDK documentation or Mastering Regular Expressions, Second Edition, by Jeffrey E. F. Friedl (O'Reilly). Find and Replace/Replace in Files (Ctrl+Shift+H)

Replace in Files is identical to the Find in Files command, described in the previous section, except that it also allows you to replace the target text string with a replacement text string.

This command is extremely useful for renaming forms, classes, namespaces, projects and so on. Renaming objects is a very common requirement, often because you don't want to be saddled with the default names assigned by Visual Studio .NET.

Renaming should not be difficult, but it can be. Object names are spread throughout a project, often hidden in obscure locations such as solution files, project files, and throughout source code files. Although all of these files are text files and so can be searched and edited, it can be a tedious and error-prone task. The Replace in Files command makes it simple, thorough, and reasonably safe. Find and Replace/Find Symbol (Alt+F12)

Clicking on this command will bring up the Find Symbol dialog box shown in Figure 2-10. This allows you to search for symbols (such as namespaces, classes, and interfaces) and their members (such as properties, methods, events, and variables).

Figure 2-10. Find Symbol dialog box

The search results will be displayed in a window labeled Find Symbol Results. From there, you can move to each location in the code by double-clicking on each result. Go To...

This command brings up the Go To Line dialog box, which allows you to enter a line number and immediately go to that line. It is context-sensitive and is visible only when editing a text window. Insert File As Text...

This command allows you to insert the contents of any file into your source code, as though you had typed it in. It is context-sensitive and is visible only when editing a text window.

A standard file browsing dialog box is presented for searching for the file to be inserted. The default file extension will correspond to the project language, but you can search for any file with any extension. Advanced

The Advanced command is context-sensitive and is visible only when editing a code window. It has many submenu items. These include commands for:

  • Creating or removing tabs in a selection (converting spaces to tabs and vice versa)

  • Forcing selected text to uppercase or lowercase

  • Deleting horizontal white space

  • Viewing white space (making tabs and space characters visible on the screen)

  • Toggling word wrap

  • Commenting and uncommenting blocks of text

  • Increasing and decreasing line indenting

  • Incremental searching (see Section Incremental search (Ctrl+I)

Incremental search allows you to search an editing window by entering the search string character by character. As each character is entered, the cursor moves to the first occurrence of matching text.

To use incremental search in a window, select the command on the Advanced submenu, or press Ctrl+I. The cursor icon will change to a binocular with an arrow indicating the direction of search. Begin typing the text string to search for.

The case sensitivity of an incremental search will come from the previous Find, Replace, Find in Files, or Replace in Files search (described earlier).

The search will proceed downward and left to right from the current location. To search backward, use Ctrl+Shift+I.

The key combinations listed in Table 2-1 apply to incremental searching.

Table 2-1. Incremental searching

Key combination



Stop the search


Remove a character from the search text


Change the direction of the search


Move to the next occurrence in the file for the current search text Bookmarks

Bookmarks are useful for marking spots in your code and easily navigating from marked spot to marked spot. There are four commands on the Bookmarks submenu (listed in Table 2-2, along with their shortcut key combinations). Note that, unless you add the item to the task list, bookmarks are lost when you close the file, although they are saved when you close the solution (so long as the file was still open).

Table 2-2. Bookmark commands


Key combination


Toggle Bookmark

Ctrl+K, Ctrl+K

Place or remove a bookmark at the current line. When a bookmark is set, a blue rectangular icon will appear in the column along the left edge of the code window.

Next Bookmark

Ctrl+K, Ctrl+N

Move to the next bookmark.

Previous Bookmark

Ctrl+K, Ctrl+P

Move to the previous bookmark.

Clear Bookmark

Ctrl+K, Ctrl+L

Clear all the bookmarks.

Add Task List Shortcut

Ctrl+K, Ctrl+H

Add an entry to the Task List (described later in the Section 2.3.5 section) for the current line. When a task list entry is set, a curved arrow icon (figs/pan2_icon0201.gif ) appears in the column along the left edge of the code window.

This menu item only appears when a code window is the current window. Outlining

Visual Studio .NET allows you to outline, or collapse and expand, sections of your code to make it easier to view the overall structure. When a section is collapsed, it appears with a plus sign in a box along the left edge of the code window (figs/pan2_icon0202.gif). Clicking on the plus sign expands the region.

You can nest the outlined regions, so that one section can contain one or more other collapsed sections. There are several commands to facilitate outlining, shown in Table 2-3.

Table 2-3. Outlining commands


Key combination


Hide Selection

Ctrl+M, Ctrl+H

Collapses currently selected text. In C# only, this command is visible only when automatic outlining is turned off or the Stop Outlining command is selected.

Toggle Outlining Expansion

Ctrl+M, Ctrl+M

Reverses the current outlining state of the innermost section in which the cursor lies.

Toggle All Outlining

Ctrl+M, Ctrl+L

Sets all sections to the same outlining state. If some sections are expanded and some collapsed, then all become collapsed.

Stop Outlining

Ctrl+M, Ctrl+P

Expands all sections. Removes the outlining symbols from view.

Stop Hiding Current

Ctrl+M, Ctrl+U

Removes outlining information for currently selected section. In C# only, this command is visible only when automatic outlining is turned off or the Stop Outlining command is selected.

Collapse to Definitions

Ctrl+M, Ctrl+O

Automatically creates sections for each procedure in the code window and collapses them all.

Start Automatic Outlining


Restarts automatic outlining after it has been stopped.

Collapse Block


In C++ only, similar to Collapse to Definitions, except applies only to the region of code containing the cursor.

Collapse All In


In C++ only, same as Collapse Block, except recursively collapses all logical structures in a function in a single step.

The default behavior of outlining can be set using the Tools Options menu item. Go to Text Editor, then the specific language for which you want to set the options. The outlining options can be set for VB .NET under Basic VB Specific, for C# under C# Formatting, and for C++ under C/C++ Formatting. IntelliSense

Microsoft Intellisense technology makes the lives of programmers much easier. It has real-time, context-sensitive help available, which appears right under your cursor. Code completion automatically completes your thoughts for you, drastically reducing your typing. Drop-down-lists provide all methods and properties possible in the current context, available at a keystroke or mouse click.

What's not to love? Intellisense does make up for a lot of Visual Studio .NET's more, shall we say, exasperating traits.

The default Intellisense features can be configured by going to Tools Options and then the language-specific pages under Text Editor.

Most of the Intellisense features appear as you type inside a code window, or allow the mouse to hover over a portion of the code. In addition, the Edit Intellisense menu item offers the commands shown in Table 2-4.

Table 2-4. Intellisense commands


Key combination


List Members


Displays a list of all possible members available for the current context. Keystrokes incrementally search the list. Press any key to insert the highlighted selection into your code; that key becomes the next character after the inserted name. Use the Tab key to select without entering any additional characters.

This can also be accessed by right-clicking and selecting List Member from the context-sensitive menu.

Parameter Info


Displays a list of number, names, and types of parameters required for a method, sub, function, or attribute.

Quick Info

Ctrl+K, Ctrl+I

Displays the complete declaration for any identifier (e.g., variable name or class name) in your code. This is also enabled by hovering the mouse cursor over any identifier.

Complete Word

Alt+Right Arrow or Ctrl+Space

Automatically completes the typing of any identifier once you type in enough characters to uniquely identify it. This only works if the identifier is being entered in a valid location in the code.

The member list presents itself when you type the dot following any class or member name.

Every member of the class is listed, and each member's type is indicated by an icon. There are icons for methods, fields, properties, events and so forth. In addition, each icon may have a second icon overlaid to indicate the accessibility of the member: public, private, protected, and so on. If there is no accessibility icon, then the member is public.

If the member list does not appear, you will want to ensure that you have added all the necessary using (or imports) statements. You'll also want to remember that Intellisense is case-sensitive in C#. Also, occasionally C# needs a rebuild before it will reflect the most recent changes.

Table 2-5 lists all the different icons used in the member lists and other windows throughout the IDE. The accessibility icons are listed in Table 2-6.

Table 2-5. Object icons


Member type










Enum item
















Map item


Method or Function


















Unknown or Error


Variable or Field

Table 2-6. Object accessibility icons


Accessibility type











2.3.5 View Menu

The View menu is a context-sensitive menu that provides access to the myriad of windows available in the Visual Studio .NET IDE. You will probably keep many of these windows open all the time, others you will use rarely, if at all.

The View menu is context-sensitive. For example if your form has no controls on it the Tab Order submenu will be grayed out.

When the application is running, a number of other windows become visible or available. These windows are accessed via the Debug Windows menu item, not from the View menu item.

Visual Studio .NET can store several different window layouts. In particular, it remembers a completely different set of open windows during debug sessions than it does during normal editing. These layouts are stored per-user, not per-project or per-solution.

This section discusses those areas that may not be self explanatory. Open and Open With . . .

These commands allow you to open the current item, i.e., the item currently selected in the Solution Explorer (described later in this section), in the program of your choice. Open uses the default editor, and Open With allows you to pick from a list of programs. You can add other programs to the list.

The Open With command also lets you open an item with the editor of your choice in Visual Studio .NET. For example, you can open a file in the binary viewer when you might normally get the resource viewer. Perhaps most usefully, you can also specify the default editor for an item. For example, you can make a web form open in code view rather than design view by default. Solution Explorer (Ctrl+Alt+L)

Projects and solutions are managed using the Solution Explorer, which presents the solution and projects, and all the files, folders, and items contained within them, in a hierarchical, visual manner. The Solution Explorer is typically visible in a window along the upper right side of the Visual Studio .NET screen, although the Solution Explorer window can be closed or undocked and moved to other locations.

To view the Solution Explorer if it is not already visible, select View Solution Explorer from the Visual Studio .NET menu. Alternatively, press the Ctrl+Alt+L keys simultaneously. A typical Solution Explorer is shown in Figure 2-11.

Figure 2-11. Solution Explorer

There are several menu buttons along the top of the Solution Explorer window. These buttons are context-sensitive (i.e., they may appear or may not appear, depending on what is the currently selected item in the Solution Explorer). Table 2-7 details the purpose of each button.

Table 2-7. Solution Explorer buttons



Shortcut keys



View Code


Displays code in main window. Only visible for source files.


View Designer

Shift +F7

Displays visual designer in main window. Only visible for items with visual components.




Refreshes the Solution Explorer display.


Copy Project


Presents dialog box for copying a project, with options for copying only the files necessary to run or all the files required for further development work.


Show All Files


Toggles display of all files in the Solution Explorer. By default, many files are not shown. If Show All Files is clicked, the solution shown in Figure 2-11 will look like Figure 2-12 after all of the nodes have been expanded.




If the currently highlighted item is a solution or a project, it displays the Properties page for that item. Otherwise, moves the cursor to the Properties window for that item.

Figure 2-12. Solution Explorer (expanded)

It is also possible to display miscellaneous files in the Solution Explorer. To do so, go to Tools Options..., then go to Environment Documents. Check the checkbox labeled Show Miscellaneous files in Solution Explorer.

Most of the functionality of the Solution Explorer is redundant with the Visual Studio .NET menu items, although it is often easier and more intuitive to perform a given chore in Solution Explorer rather than in the menus. Right-clicking on any item in the Solution Explorer will pop up a context-sensitive menu. Three different pop-up menus from Solution Explorer are shown in Figure 2-13. From left to right, they are for a solution, a project, and a source code file.

Figure 2-13. Solution Explorer context-sensitive menus for solutions, projects, and source files

Several points concerning the commands on these pop-up menus deserve mention:

  • The Add command for solutions and projects offers submenus that allow new or existing items to be added. These commands are also found on the main Project menu.

  • Set Startup Projects and Exclude From Project commands can also be found on the main Project menu.

  • The Build and Rebuild commands duplicate commands found on the main Build menu.

  • The Debug command submenus include two commands found on the main Debug menu.

  • If the Properties item is clicked for a source file, the cursor moves to the Properties window. If the Properties item is clicked for a solution or project, the Property Pages for that item are opened. Properties Windows (F4)

The Properties window displays all the properties for the currently selected item. Some of the properties (such as Font and Location) have subproperties, indicated by a plus sign next to their entries in the window. The property values on the right side of the window are editable.

One thing that can be confusing is that certain items have more than one set of properties. For example, a Form source file can show two different sets of properties, depending on whether you select the source file in the Solution Explorer or the form as shown in the Design view.

A typical Properties window, with the Font subproperty expanded out, is shown in Figure 2-14.

Figure 2-14. Properties window

The name and type of the current object is displayed in the field at the top of the window. In Figure 2-14, it is an object named Label1 of type Label, contained in the System.Web.UI.WebControls namespace.

The Font property has subproperties that may be set either directly in the window or either by clicking on the drop-down or the button with three dots on it.

The Properties window has several buttons just below the name and type of the object. The first two buttons on the left toggle the list by category or alphabetically. The next button from the left displays properties for an object. The rightmost button displays property pages for the object, if there are any.

Some objects have both a Properties window and Property Pages. The Property Pages display additional properties from those shown in the Properties window.

If the project is in C#, then there will be an additional lightening bolt button (figs/pan2_icon0238.gif) that is used to create event handlers for an item. Events are covered in Chapter 3.

For some controls, such as the Calendar, there is an additional panel as part of the Properties window with verbs, such as AutoFormat.

The box below the list has a brief description of the selected property. Server Explorer (Ctrl+Alt+S)

The Server Explorer allows you to access any server to which you have network access. If you have sufficient permissions, you can log on, access system services, open data connections, access and edit database information, access message queues and performance counters, and more. You can also drag nodes from the Server Explorer onto Visual Studio .NET projects, creating components which reference the data source.

A typical Server Explorer is shown in Figure 2-15. It is a hierarchical view of the available servers. In this figure, there is only one server available, ATH13T. The figure shows a drill-down into SQL Server, showing the tables in the Northwind database. These tables, and all other objects in this tree view, are directly accessible and editable from the window.

Figure 2-15. Server Explorer
figs/pan2_0215.gif Class View (Ctrl+Shift+C)

The Class View shows all the classes in the solution in a hierarchical manner. A typical Class View, somewhat expanded, is shown in Figure 2-16. The icons used in this window are listed in Table 2-5 and Table 2-6.

Figure 2-16. Class View

As with the Solution Explorer, any item in the class view can be right clicked, which exposes a pop-up menu with a number of context-sensitive menu items. This can provide a convenient way to sort the display of classes in a project or solution, or to add a method, property or field to a class.

The button on the left above the class list allows for sorting the classes listed, either alphabetically, by type, by access, or grouped by type. Clicking on the button itself sorts by the current sort mode, while clicking on the down arrow next to it presents the other sort buttons and changes the sort mode.

The button on the right above the class list allows you to create virtual folders for organizing the classes listed. These folders are saved as part of the solution in the .suo file.

These folders are virtual (i.e., they are illusory). They are only used for viewing the list. As such, they have no effect on the actual items. Items copied to the folder are not physically moved, and if the folders are deleted, the items in them are not lost. Note that if you rename or delete an object from the code that is in a folder, you may need to manually drag the item into the folder again to clear the error node. Object Browser (Ctrl+Alt+J)

The Object Browser is a tool for examining objects (such as namespaces, classes, and interfaces), and their members (such as methods, properties, variables, and events). A typical Object Browser window is shown in Figure 2-17.

The objects are listed in the pane on the left side of the window, and members of the object, if any, are listed in the right pane. The objects are listed hierarchically, with the ability to drill down through the tree structure. The icons used in this window are listed in Table 2-5 and Table 2-6.

Right clicking on either an object or a member brings up a context-sensitive pop-up menu with a variety of menu options.

Figure 2-17. Object Browser
figs/pan2_0217.gif Other Windows

There are several other windows which have been relegated to a submenu called Other Windows. These include:

Macro Explorer (Alt+F8)

Visual Studio .NET offers the ability to automate repetitive chores with macros. A macro is a set of instructions written in VB .NET, either created manually or recorded by the IDE, saved in a file. The Macro Explorer is the one of the main tools for viewing, managing, and executing macros. It provides access into the Macro IDE.

Macros are described further in Section 3-11.

Document Outline (Ctrl+Alt+T)

The Document Outline window is used when designing web forms to provide an outline view of the HTML document.

Task List (Ctrl+Alt+K)

In large applications, keeping a to-do list can be quite helpful. Visual Studio .NET provides this functionality with the Task List window. You can also provide shortcuts to comments in the Task List along with token strings, such as TODO, HACK, or UNDONE. Also, the compiler populates the Task List with any compile errors.

Command window (Ctrl+Alt+A)

The Command window has two modes: Command and Immediate.

Command mode is used to enter commands directly, either bypassing the menu system or executing commands that are not contained in the menu system. (You can add any command to the menu or a toolbar button using Tools Customize.)

Immediate mode is used when debugging to evaluate expressions, view and modify variables, and other debugging tasks. The Immediate window and debugging will be covered further in Chapter 7.

For a complete discussion of command window usage, consult the SDK documentation.

Output (Ctrl+Alt+O)

The Output window is used to display status messages from the IDE to the developer, including debugger messages, compiler messages, output from stored procedures, and others.

2.3.6 Project Menu

The Project menu provides functionality related to project management. All of the functionality exposed by the Project menu is also available in the Solution Explorer. It is often easier and more intuitive to accomplish your goals in Solution Explorer, but the menus lend themselves to keyboard use.

Each of the commands under this menu pertain to the object currently highlighted in the Solution Explorer. Add . . .

The Add menu includes several commands that allow you to add either an existing or a new item to a project. They are self-explanatory, offering the same functionality as the equivalent items described previously under the File command.

These include:

  • Add Windows Form

  • Add Inherited Form

  • Add User Control

  • Add Inherited Control

  • Add Component

  • Add Class

  • Add New Item (Ctrl+Shift+A)

  • Add Existing Item (Shift+Alt+A)

Other commands of particular interest include: Exclude From Project

Exclude From Project will remove the file from the project but leave the file intact on the hard drive. This is in contrast with the Delete command found on pop-up menus in the Solution Explorer, which will remove the file from the project and delete it from the hard drive (actually into the Recycle Bin). If there is a resource file associated with the file, it will also be excluded or deleted, respectively.

The Exclude From Project command is also available in the Solution Explorer by right-clicking on a file. Add Reference...

The Add Reference command is available in the Solution Explorer by right-clicking on a project. In either case, you will get the Add Reference dialog box shown in Figure 2-18. This allows you to reference assemblies or DLL's external to your application, making the public classes, methods, and members contained in the referenced resource available to your application.

Figure 2-18. Add Reference dialog box
figs/pan2_0218.gif Add Web Reference...

The Add Web Reference command, also available in the Solution Explorer by right-clicking a project, allows you to add a web reference to your project, thereby becoming a consuming application of a web service.

Web services and distributed applications are covered in Chapter 15. Set as StartUp Project

If there is more than one project in a solution, then you must specify which is the startup project. This command, also available in the Solution Explorer by right-clicking a project, allows you to make that specification. The project highlighted in Solution Explorer when this command is executed will become the startup project. Project Dependencies... / Project Build Order...

These commands, visible only when a solution contains multiple projects, also available in the Solution Explorer by right-clicking a project, present a dialog box that allows you to control the build order of the projects in a solution. It presents a dialog box with two tabs, one for Dependencies and one for Build Order.

The Project Dependencies command allows you to specify, for each project in the solution, which projects it depends upon. The dependent projects will be built first.

The Project Build Order command presents a list of all the projects in the order in which they will be built.

Note that if you are using Project References (as added with the Add Reference dialog mentioned previously) you won't be able to edit either of these. Project Dependencies are inferred when there are references between projects in the same solution. Also you can't change the Build Order in any case. It is always inferred from the dependencies, whether those dependencies were automatically inferred or not.

2.3.7 Build Menu

The Build menu offers menu items for building the current project (highlighted in Solution Explorer) or the solution. It also exposes the Configuration Manager for configuring the build process. The Build menu will be covered in detail in Chapter 20.

2.3.8 Debug Menu

The Debug menu allows you to start an application with or without debugging, set breakpoints in the code, and control the debugging session. The Debug menu item will be covered along with the topic of debugging in Chapter 7.

2.3.9 Data Menu

This context-sensitive menu is visible only when in design mode. It is not available when editing code pages. The commands under it are only available when there are appropriate data controls on the form. Data controls and data binding will be covered in Chapter 11 through Chapter 13.

2.3.10 Format Menu

The Format menu is visible only when in design mode, and further, the commands under it are available only when one or more controls on the form are selected.

This menu offers the ability to control the size and layout of controls, although many of the menu options are grayed out for web form controls. You can:

  • Align controls with a grid or with other controls six different ways

  • Change the size of one or more controls to be bigger or smaller or all be the same

  • Control the spacing both horizontally and vertically

  • Move controls forwards or back in the vertical plane (Z order) of the form

  • Lock a control so that its size or position cannot be changed

To operate on more than one control, select the controls in one of several ways:

  • Hold down the Shift or Ctrl key while clicking on controls to be selected.

  • Use the mouse to click and drag a selection box around all the controls to be selected. If any part of a control falls within the selection box, then that control will be included.

  • To unselect one control, hold down the Shift or Ctrl key while clicking that control.

  • To unselect all the controls, select a different control or press the Esc key.

When operating on more than one control, the last control selected will be the baseline. In other words, if you are making all the controls the same size, they will all become the same size as the last control selected. Likewise, if aligning a group of controls, they will all align with the last control selected.

As controls are selected, they will display eight resizing handles. These resizing handles will be black for all the selected controls except the baseline, or last control, which will have white handles.

With that in mind, all of the commands under the Format menu are fairly self-explanatory.

2.3.11 Tools Menu

The Tools menu presents commands accessing a wide range of functionality, ranging from connecting to databases to accessing external tools to setting IDE options. Some of the more useful commands are described in the following sections. Connect to Device . . .

Brings up a dialog box that allows you to connect to either a phyiscal mobile device or an emulator. Connect to Database...

The Connect To Database command default brings up the dialog box that allows you to select a server, log in to that server, and connect to the database on the server. Microsoft SQL Server is the database (surprise!), but the Provider tab allows you to connect to any number of other databases, including any for which there are Oracle, ODBC, or OLE DB providers. Connect to Server...

The Connect to Server command brings up the dialog box that lets you specify a server to connect to, either by name or by IP address. It also lets you connect using a different username and password.

This same dialog box can be exposed by right clicking on Servers in the Server Explorer, and selecting Add Server... from the pop-up menu. Add/Remove Toolbox Items . . .

This command brings up the Customize Toolbox dialog box shown in Figure 2-19. The dialog box has two tabs: one for adding (legacy) COM components and one for adding .NET CLR-compliant components. All the components available on your machine (which include registered COM components and .NET components in specific directories—you can browse for .NET components if they are not listed) are listed in one or the other. In either case, check or uncheck the box in front of the component to include or not include the desired component.

Figure 2-19. Customize Toolbox dialog box

For adding .NET components to the toolbox, it is generally easier to just drag it from Windows Explorer onto the toolbox.

It is also possible to add other tabbed lists to this dialog box, although the details for doing so are beyond the scope of this book.

You can sort the components listed in the dialog box by clicking on the column head that you wish to sort by. Build Comment Web Pages...

This menu command brings up a dialog box that allows you to document your application via HTML pages. These HTML pages automatically display the code structure of your application. Projects are listed as hyperlinks. Clicking on a project brings up a page that shows all the classes as hyperlinks on the left side of the page. Clicking on any class lists all the class members, with descriptions, on the right side of the page.

If your language supports XML code comments (as does C#, but VB .NET does not), then you can add your own comments to your source code and those comments will display in these web pages.

Comment web pages are created by default in a subdirectory of the project called CodeCommentReport. Macros

Macros are a wonderful feature that allows you to automate tasks in the IDE. Macros can either be coded by hand or recorded as you perform the desired task. If you allow the IDE to record the macro for you, then you can subsequently examine and edit the macro code it creates. This is very similar to the macro functionality provided as part of Microsoft Word or Microsoft Excel.

Be aware that macro recording doesn't work for anything inside a dialog box. For example, if you record the changing of some property in a project's Property Pages, the recorded macro will open the Property Pages but won't do anything in there!

You can easily record a temporary macro by using the Macros Record TemporaryMacro command, or by pressing Ctrl+Shift+R. This temporary macro can then be played back using the Macros Run TemporaryMacro command, or by pressing Ctrl+Shift+P. It can be saved using the Macros Save TemporaryMacro command, which will automatically bring up the Macro Explorer, described next.

Macros are managed using the Macro Explorer window, accessed via a submenu of the Macros command, or by pressing Alt+F8, shown in Figure 2-20 after recording a temporary macro.

Figure 2-20. Macro Explorer

Right-clicking on a macro in the Macro Explorer pops up a menu with four items:


Runs the highlighted macro. The macro can also be run by double clicking on the macro name.


Brings up the macro editing IDE, where all the macros for the user can be edited. The macro language is VB .NET, irrespective of the language used for the project. The macro editing IDE can also be invoked using the Macros Macro IDE command, or by pressing Alt+F11.


Allows the macro to be renamed.


Deletes the macro from the macro file.

All the macros are contained in a macro project called, by default, MyMacros. This project is comprised of a binary file called MyMacros.vsmacros (unless you have elected to convert it to the multiple files format), which is physically located in the Documents and Settings directory for each user. You can create a new macro project by using the Macros New Macro Project command or by right clicking on the root object in the Macro Explorer and selecting New Macro Project. In either case, you will get the New Macro Project dialog box, which will allow you to specify the name and location of the new macro project file.

Macro projects contain modules, which are units of code. Each module contains subroutines, which correspond to the macros. So for example, the macro called TemporaryMacro shown in Figure 2-20 is the TemporaryMacro subroutine contained in the module named RecordingModule, which is part of the MyMacros project. External Tools...

Depending on the options selected at the time Visual Studio .NET was installed on your machine, you may have one or more external tools available on the Tools menu. These might include tools such as Create GUID, ATL/MFC Trace Tool, or Spy++. (Use of these tools is beyond the scope of this book.)

The Tools External Tools... command allows you to add additional external tools to the Tools menu. When selected, you are presented with the External Tools dialog box. This dialog box has fields for the tool title, the command to execute the tool, any arguments and the initial directory, as well as several checkboxes for different behaviors. Customize...

The Customize... command allows you to customize many aspects of the IDE user interface. (The Options... command, described in the following section, allows you to set a variety of other program options.) It brings up the Customize dialog box, which has three different tabs plus one additional button, allowing customization in four different areas.


This tab, shown in Figure 2-21, presents a checkbox list of all the available toolbars, with checkmarks indicating those toolbars currently visible. You can control the visibility of specific toolbars by checking or unchecking them in this list, or alternatively, use the View Toolbars command.

You can also create new toolbars, rename or delete existing toolbars, or reset all the toolbars back to the original installation version on this tab.

Figure 2-21. Customize dialog—Toolbars tab

The Commands tab, shown in Figure 2-22, allows you to add or remove commands from a toolbar or modify buttons already on the toolbar.

To add a command to a toolbar, select the category and command from the lists in the dialog box, then use the mouse to drag the command to the desired toolbar.

To remove a command from a toolbar, drag it from the toolbar to anywhere in the IDE while the Customize Commands dialog is showing.

The Modify Selection button is only active when a button on an existing toolbar is selected. It allows you to perform such chores as renaming or deleting the button, changing the image displayed on the button, changing the display style of the button (image only, text only, etc.), and organizing buttons into groups.

Figure 2-22. Customize dialog—Commands tab

The Options tab, shown in Figure 2-23, allows you to change the appearance of toolbars.

The personalized Menus and Toolbars checkboxes are always unavailable and grayed out.

The Other checkboxes allow selection of icon size on buttons, control of tool tips, and the way the menus come in to view (Menu animations).

Figure 2-23. Customize dialog—Options tab

The Keyboard... button brings up the Environment Keyboard page, shown in Figure 2-24, also accessible under the Tools Options command described below. This page allows you to define and change keyboard shortcuts for commands.

Figure 2-24. Customize dialog—Keyboard button
figs/pan2_0224.gif Options...

The Options... command also brings up the Options dialog box, shown in Figure 2-24. This dialog box allows setting a wide range of options, ranging from the number of items to display in lists of recently used items to XML Designer options.

The dialog box displays a hierarchical list of categories on the left side. Selecting any category allows you to drill down through the tree structure. Clicking on a detail item brings up the available properties on the right side of the dialog box.

Most of the available options are fairly self-explanatory. If you have any questions about specific settings, clicking on the Help button at the bottom of the Options dialog box will bring up context-sensitive help about all the properties relevant to the current detail item.

2.3.12 Window Menu

The Window menu is a standard Windows application Window command. It displays a list of all the currently open windows, allowing you to bring any window to the foreground by clicking on it. Note that all the file windows currently displayed in the IDE also have tabs along the top edge of the design window, below the toolbars (unless you have selected MDI mode in Tools Options Environment General), and windows can be selected by clicking on a tab.

This is a context-sensitive menu. The menu items available for different circumstances are listed in Table 2-8.

Table 2-8. Window menu item commands

Current window

Description of available commands


Auto Hide All hides all dockable windows. Clicking on window's pushpin icon turns AutoHide off for that window.

New Horizontal/Vertical Tab Group creates another set of windows with it own set of tabs.

Close All Documents is self-explanatory.

Window list.


Same as for a design window plus the following: New Window creates a new window containing the same file as the current window (use this to open two windows to the same source file); Split creates a second window in the current window for two different views of the same file; and Remove Split removes a split window.


This category of window includes the Solution Explorer, the Properties window, the Class View window, the toolboxes, etc. These windows are dockable, as indicated by the pushpin icon in the upper right corner of each.

Available menu items are the same as for a design window, with the addition of commands to dock, hide or float a window.

2.3.13 Help Menu

The Help menu provides access to a number of submenus. Those that are not self-explanatory are described here. Dynamic Help (Ctrl+F1)

If you are developing on a machine with enough horsepower, Dynamic Help is a wonderful thing. Otherwise, it is quite a performance hog. (It can be disabled by unchecking all the checkboxes under Tools Options Environment Dynamic Help) Alternatively, just closing the window is sufficient to prevent the performance hit, and that way it is still available when you need it.

That said, using Dynamic Help is very simple. Open a Dynamic Help window by clicking on this menu item or pressing Ctrl+F1. Then wherever the focus is, whether in a design, code or dockable window, context-sensitive hyperlinks will appear in the Dynamic Help window. Click on any of these links to bring up the relevant help topic in a separate window. Contents... (Ctrl+Alt+F1) / Index... (Ctrl+Alt+F2) / Search... (Ctrl+Alt+F3)

These three commands provide different views into the SDK help system, allowing you to search by a (pseudo) table of contents, an incremental index, or a search phrase, respectively. The first type of search is an indexed search, while the latter two are full text searches, so you may get different results using the different search types using the same phrase.

The Help system exposed by these commands is the exact same Help system exposed in two other places by the Start button:

Programs -> Microsoft Visual Studio .NET -> Microsoft Visual Studio .NET Documentation 
Programs -> Microsoft .NET Framework SDK -> Documentation

This Help tool uses a browser-type interface, with Forward and Back navigation and Favorites. The list of topics is displayed in the left hand pane, and the help topic itself, including hyperlinks, is displayed on the right. Index Results... (Shift+Alt+F2)

When searching for Help topics by Index, there are often many topics for a given index entry. In these cases, the multiple topics are listed in an Index Results window. This window will display automatically if this is the case. This command allows you to view the Index Results window if it has been closed. Search Results... (Shift+Alt+F3)

The Search Results window is exactly analogous to the Index Results window described previously, except it pertains to searching for Help topics by search phrase. Edit Filters...

The SDK Help system is voluminous, with information on the full array of topics which might be found in any .NET installation, as well as a ton of non-.NET stuff. The Edit Filters command allows you to restrict which Help topics will be searched. For example, if you are working exclusively in C#, you might set the filter to either Visual C# or Visual C# and Related. (The references of several O'Reilly .NET Nutshell titles are available as installable Dynamic Help files. For further information, see Check for Updates

This command will check for service releases for your currently installed version of Visual Studio .NET. In order for this command to work, your machine must be connected to the Internet. If there is an update available, you will be prompted to close the IDE before the service release is installed.

    Previous Section Next Section

    JavaScript Editor Javascript validator     Javascripts