Part II
Upgrading
Applications
5 Your First Upgrade 79
6
Common Tasks in Visual Basic .NET 101
7
Upgrading Wizard Ins and Outs 117
8
Errors, Warnings, and Issues 149
9
Using Visual Basic 6 with Visual Basic .NET: COM Interop 175
C0561587x.fm Page 77 Thursday, November 15, 2001 2:37 PM
C0561587x.fm Page 78 Thursday, November 15, 2001 2:37 PM
79
Your First Upgrade
In Part I, we explored the differences between Microsoft Visual Basic 6 and
Visual Basic .NET, looked at the different upgrading options, and covered how
to prepare your Visual Basic 6 application for the upgrade to Visual Basic .NET.
Now it’s time to begin talking about the how-to of upgrading. This chapter
walks you through the process of using the Upgrade Wizard to upgrade a sim-
ple project and examining what your new Visual Basic .NET project looks like.
It also introduces you to techniques for fixing problems with the upgraded
project and discusses some advanced upgrading techniques such as upgrading
project groups and using the VB6 Snippet Upgrade add-in.
Upgrade Walkthrough
Let’s start by creating a simple project in Visual Basic 6. We will assume that you
have Visual Basic 6 and Visual Basic .NET installed on the same machine. Hav-
ing both versions installed is actually a recommended configuration. Visual
Basic .NET installs to a different directory than Visual Basic 6. If Visual Basic 6
is already installed, it is left intact. Visual Basic .NET does not overwrite any
Visual Basic 6 files—the two versions can be installed and run side by side. The
order of installation doesn’t matter either; you can set up Visual Basic 6 after
installing Visual Basic .NET or vice versa. The benefits of installing both prod-
ucts on the same machine are twofold:
It allows you to ensure that your project actually runs. (If the project
doesn’t work in Visual Basic 6, it’s unlikely that it will work after
upgrading.)
C0561587x.fm Page 79 Thursday, November 15, 2001 2:37 PM
80
Part II Upgrading Applications
Visual Basic 6 Setup installs common ActiveX c