JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Upgrading from Visual Basic 6.0

The difference between VB6 and VB .NET is great, and to help you upgrade VB6 projects to VB .NET projects, Microsoft created the Visual Basic Upgrade Wizard. This Wizard is automatically invoked when you try to open a VB6 project, and you can see it in Figure 1.18.

Click To expand
Figure 1.18: The Visual Basic Upgrade Wizard.

This Wizard attempts to convert VB6 projects to VB .NET projects, but in all but the simplest cases, I've found it inadequate, because the differences are too great. When you do upgrade a VB6 project of any complexity, you'll usually find the resulting code filled with Visual Basic comments—lines of text that begin with an apostrophe (') to indicate to Visual Basic that they contain comments intended to be read by a person, not code to execute like this:

If blnDrawFlag Then
    'UPGRADE_ISSUE: Graphics statements can't be migrated.
    'Click for more: ms-help://MS.MSDNVS/vbcon/html/vbup2034.htm
End If

In the majority of cases, the differences between VB6 and VB .NET are simply too many for the Upgrade Wizard to overcome. However, give it a try if you'd like; it can convert some of your application's code and perhaps save you a little time.


If you're truly stuck, you might try importing the Microsoft.VisualBasic.Compatibility.VB6 namespace (we'll see how importing works in Chapter 2) into your application, which gives you access to obsolete VB6 keywords like Open, Close, CreateObject, and so on.

Unfortunately, for any but the simplest project, I suggest recoding by hand. It can be a tedious process, but there's no alternative.

We've completed an overview of the differences between Visual Basic 6.0 and VB .NET, and now it's time to get cracking with VB .NET itself. The first aspect to examine is the .NET part of VB .NET, and I'll do that now.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor