Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step By Step

The Visual Studio .NET environment includes a wide array of tool windows, toolbars, and menus to provide developers with a great deal of flexibility in performing development tasks. You can perform any given task, such as adding an item to a project, by using a tool window, a toolbar button, or a menu selection. While this flexibility is a good thing, it can be a little overwhelming at first. To make it easier for you to find your way around, let’s take a tour through the new enhancements, tool windows, toolbars, and menus of the Visual Studio .NET IDE.

IDE Enhancements

The new enhancements you’ll find in the Visual Studio .NET IDE include the following:

Use tabbed documents

  1. With the Chapter_01 project opened in the IDE, double-click the Welcome.aspx file in the Solution Explorer window.

    A new tab will be added to the editor, as shown in the following illustration.

  2. Switch between open documents (including the Start Page) by clicking on the tab for the document you want to switch to.

    If there are more tabs than will fit onscreen, you can scroll to view the hidden tabs using the Scroll buttons, as shown below, at the top of the editor window. You can close the currently selected document by clicking the Close button, as shown below, at the top of the editor window.

New Features

In addition to the IDE enhancements, a number of entirely new features have been added to the Visual Studio .NET IDE.

IDE Windows

While you work with Visual Studio .NET, you’ll encounter a wide variety of windows in the IDE, used for a wide variety of purposes. Some are new, like the Dynamic Help window described in the previous section, while some will be familiar to users of previous versions of Visual Studio. In this section, we’ll take a look at the most commonly used windows.

Now that you’ve seen some of the main windows in the IDE, put your knowledge to work by following these procedures.

Switch views in the Editor

  1. Open the Welcome.aspx page, if it’s not already open, by double- clicking the file in the Solution Explorer window. (You can tell if the file is open by reading the tab labels along the top of the editor.)

  2. Click the HTML button, as shown in the following illustration, to switch to HTML view for the page (you can switch back by clicking the Design button, as shown below).

    When you click the HTML button, the HTML code for the page will be displayed, as shown in the following illustration.

Use the Properties window to modify properties

  1. Open the Welcome.aspx file, if it isn’t already open, by double-clicking the file in the Solution Explorer window. Make sure you’re in Design view—if not, click the Design button to switch to Design view.

  2. Click the text “Welcome to ASP.NET!” to select the control it represents.

    This is an ASP.NET Label server control. (You’ll learn more about ASP.NET server controls in later chapters.) When you select the control, its properties are displayed in the Properties window, as shown in the following illustration.

  3. Click the + symbol next to the Font property to expose its sub-properties.

  4. Select the Bold property, and then click its drop-down list to change the property value to True.

  5. Select the Size property, and then click its drop-down list to change the property value to Large.

    Note how the text displayed is modified in the following illustration.

  6. Center the Label control over the image by clicking and dragging the control in the designer window, and then save the file by clicking the Save button, as shown in the following illustration, on the toolbar.

  7. Browse the page by right-clicking Welcome.aspx in Solution Explorer and selecting View In Browser.

    The result should look similar to the following illustration.

Toolbars

To accomplish tasks in Visual Studio .NET, you’ll most likely use a combination of the IDE’s toolbars and menus. This section will take a look at the most commonly used toolbars, and the next section will look at the most commonly used menus. You can view the full list of available toolbars by right-clicking any toolbar (or empty toolbar area). In keeping with the customizable nature of the Visual Studio .NET IDE, all toolbars can be customized by adding, removing, or rearranging buttons, moving toolbars, and showing or hiding toolbars.

Note

Given the flexibility of the Visual Studio .NET toolbars, it’s easy to end up with your toolbars looking nothing like they did when you installed Visual Studio. For some developers this might be a good thing, but if you want to restore your toolbars to their original configuration, click the Toolbar Options button (which looks like the arrow of a drop-down list control) found at the right end of each toolbar, then click Add Or Remove Buttons, then click the menu item for the toolbar name, and then click Reset Toolbar.

Menus

A great many menus are available in Visual Studio .NET, depending on the task you’re working on at any given time. While we won’t go over all of them, the menus you’ll encounter most frequently in your Visual Studio travels are listed here.

Tip

In addition to these menus, you can create your own custom menus. To create a custom menu, right-click anywhere in the menu bar and select Customize. In the Customize dialog box, click the Commands tab. Under Categories, select New Menu. Under Commands, click and drag the New Menu item to the desired location in the menu bar. Next, right-click the new menu heading and use the Name entry to give your new menu a name. Now you can drag items from the other menu categories to your new menu. To create a submenu, drag another copy of the New Menu item into the desired location on your menu.

Options

One of the most dramatic areas of improvement in Visual Studio .NET is in customization. Much of the customization available in Visual Studio .NET is controlled from the Options dialog box, shown in the following illustration. As mentioned earlier, you can access this dialog box by selecting Tools, and then Options. Not only has the number of options increased significantly, but the degree of control over particular options has increased as well.

One good example of this increased control is in the area of code formatting. Visual InterDev developers will no doubt remember the frustration of having the Visual InterDev editor reformat their ASP code when switching from Design view to Source view. Visual Studio .NET still performs code formatting, but the developer has language-by-language control over how this formatting is done. (Note that not all languages use auto-formatting, so they won’t all have these options.) Go to the Text Editor option folder, choose the language (for example, HTML or CSS), and set the options to your preferred setting. In this way, you can determine how formatting is applied to your code or, for some languages, you can turn off reformatting entirely.

Note

One new option that will appeal to longtime BASIC users is having the IDE display line numbers in the text editor. Unlike BASIC, however, the line numbers are only for reference; they’re not actually a part of the code. You can turn this option on or off for individual languages, or you can turn it on globally for all languages.

Exiting Visual Studio .NET

When you’re finished working with a given project, naturally you’ll want to exit from Visual Studio .NET.

Exit Visual Studio .NET

  1. Save any open files, using the Save All button, as shown in the following illustration, on the toolbar or by selecting Save All from the File menu.

  2. From the File menu, select Exit.

    Visual Studio .NET shuts down.

Категории