How To Upgrade a Visual Basic 6.0 Project Group to Visual Basic .NET

SUMMARY
This article describes how to upgrade a Visual Basic 6.0 project group or an n-tier application to Visual Basic .NET.

Description of the Technique
If you upgrade a Visual Basic 6.0 project group or an n-tier application to Visual Basic .NET, you must upgrade one project or tier at a time.

If your three-tier application includes a client component, a business component, and a data access component, you should upgrade the application in the following order:

1. Client componentBusiness componentData access component
2. Business componentData access component
3. Data access component

In an n-tier application, always upgrade the client tier first, and then upgrade other tiers on the dependency tree. You should follow this order for two reasons:

? This approach allows you to keep the application working. When you upgrade the client, you break and work with only one component of the application. All of the other components continue to work the same way that they did previously. With this approach, you isolate the work area. Alternately, if you upgrade the data tier first, suddenly you break the data tier and the components that depend on the data tier.
? Visual Basic 6.0 locks type libraries (TypeLibs). This creates a problem if you need to rebuild the TypeLib or recompile the underlying dynamic-link library (DLL). If you upgrade the business tier first and then upgrade the client, you must continually stop and restart Visual Basic 6.0 every time you change the middle tier. Consider the following workflow:

1. Upgrade the middle tier.Change the Visual Basic 6.0 client to access the middle tier.Run the middle tier.
2. Change the Visual Basic 6.0 client to access the middle tier.Run the middle tier.
3. Run the middle tier.

If you want to change the .NET DLL, you must then close Visual Basic 6.0, recompile in .NET, restart Visual Basic 6.0, and so on. You can avoid this problem if you upgrade the client first and then upgrade the middle tier.

To upgrade each Visual Basic 6.0 application, use the Upgrade tool that is included with Visual Basic .NET. The Upgrade tool is started when you use Visual Basic .NET to open a Visual Basic 6.0 project. When you use the Upgrade tool, the Visual Basic 6.0 project is not changed, and a new Visual Basic .NET project is created. Before you upgrade a Visual Basic 6.0 project, it is best to prepare it for upgrade. For more information, refer to the REFERENCES section.

Upgrade an N-Tier Visual Basic 6.0 Application to Visual Basic .NET

This section provides in-depth information about how to upgrade a three-tier Visual Basic 6.0 application (which consists of a client component, a business component, and a data access component) to Visual Basic .NET.

1. Compile each of the projects in Visual Basic 6.0, and test the projects to ensure that the application works properly.

NOTE: It is important to build the group because the new Visual Basic .NET client project still uses the business and data component from Visual Basic 6.0 through Interop. Similarly, the new Visual Basic .NET business component project still references the data component from Visual Basic 6.0 through Interop.
2. Upgrade the client component first. Start Microsoft Visual Studio .NET, and open the Visual Basic 6.0 client project. The Upgrade Wizard is started.NOTE: The Visual Basic .NET Upgrade Wizard is included in Visual Studio .NET Professional.


3. Follow the steps in the wizard to create a new Visual Basic .NET client project and an upgrade report.
4. Review the upgrade report, which typically includes warnings about additional modifications that are required. Modify the new Visual Basic .NET client project as recommended.
5. Run the new Visual Basic .NET client project to verify that the client works. Remember that the new client still references the Visual Basic 6.0 business and data access component through Interop.
6. Upgrade the middle tier (the business object). Open the Visual Basic 6.0 business object project in Visual Basic .NET, and complete the steps in the Upgrade Wizard.
7. Review the upgrade report, and modify the new Visual Basic .NET business component as recommended.
8. Because the new Visual Basic .NET client project still references the Visual Basic 6.0 business component, delete this reference, and add a new reference to the newly created Visual Basic .NET business component project.
9. Test the application to ensure that it works properly. Remember that the client and business components are still using the Visual Basic 6.0 data access component.
10. Upgrade the final tier (the data access component). Open the Visual Basic 6.0 data access component project in Visual Basic .NET, and complete the steps in the Upgrade Wizard.
11. Review the upgrade report, and modify the new Visual Basic .NET data access component as recommended.
12. Delete any references to the Visual Basic 6.0 data access component in the Visual Basic .NET business and client components, add references to the new Visual Basic .NET data access component project.
13. Test the application to ensure that it works properly.


REFERENCES
For more information, refer to the following Microsoft Web sites:
Preparing Your Visual Basic 6.0 Applications for the Upgrade to Visual Basic.NET
http://msdn.microsoft.com/library/default....6tovbdotnet.asp

Visual Basic .NET Upgrade Roadmap
http://msdn.microsoft.com/vbasic/technical...ade/roadmap.asp

APPLIES TO
? Microsoft Visual Basic .NET 2002 Standard Edition