RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Fall In Love with Visual Basic All Over Again in Visual Studio 2008

Discover anew why Visual Basic is one of the most successful programming languages in history by exploring some of the new features Microsoft added to Visual Studio and Visual Basic.

ou undoubtedly know by now that Visual Studio 2008 was released to manufacturing in November, just in time for Christmas. It comes wrapped up with a new version of Visual Basic, which includes (among others) these great new features:

  • Enhanced IntelliSense
  • Snippets that Work
  • Friend Assemblies
  • Updated Ternary Operator
  • Better Nullable Types
  • Partial Methods
  • Object Initializers
  • Implicit Types / (Local) Type Inference
  • Anonymous Types
  • Relaxed Delegates
  • Extension Methods
Author's Note: The list is color coded: the green items are features I love, the red items are features you should avoid, and the blue item is a feature I think you should be wary of. The section heading colors for the listed items match the list colors, so you can immediately tell how I feel about each feature.

While many of the great enhancements in the 2008 version of Visual Studio involve Language-Integrated Query (LINQ), this article focuses instead on enhancements made directly to Visual Basic 9. As you probably know, LINQ is the star of Visual Studio 2008, and Microsoft included many of the features in the list expressly to support LINQ.

To get the greatest benefit from this article, I recommend that you download the sample code and work through that as you read. Many of the examples refer directly to the sample code project. When you open the sample solution, you'll notice that the main form window contains buttons whose names match the feature list above. As you read, double-click the appropriate form button and Visual Studio will open the Click event handler for the button. These event handlers serve as the sample code for each feature. In some cases, other classes may be part of the sample code as well, but those cases will be clearly stated in the article.

Multi-Targeting Support in Visual Studio 2008
Before reviewing the features individually, unlike previous versions of Visual Studio, where the version of the IDE was tied directly to a version of the .NET Framework, Visual Studio 2008 supports multi-targeting. This means you can select from among versions 2.0, 3.0, and 3.5 of the .NET Framework to determine the target version to use when building your solution. This is a wonderful feature because it means you don't have to wait for your development group to adopt the 3.5 framework to start using Visual Studio 2008. I've mentioned it here because some of the new features new to VB9 are available to you even if you continue to target the 2.0 framework. As you read through the new features, I'll point out the features you are free to use immediately.

For new projects, you can choose the framework version from the upper right corner of the New Project dialog (see Figure 1).

To change the framework version for an existing project, open the Project Properties, select the Compile tab, and then click the "Advanced Compile Options…" button. That opens another dialog. You can then change the framework target by selecting it from the "Target framework" dropdown shown in Figure 2.

Figure 1. Targeting a Framework in New Projects: Visual Studio 2008's "New Project" dialog lets you select the framework your new project will target.
Figure 2. Targeting a Framework in Existing Projects: Drill down through the Project Properties dialog to change the framework target by selecting the "Compile" tab, and then clicking the "Advanced Compile Options..." button.
For the curious, notice that the project's list of referenced assemblies changes depending on which framework target you choose.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date