Microsoft KB Archive/309617

= How to upgrade a Visual Basic 6.0 project group to Visual Basic .NET or Visual Basic 2005 =

Article ID: 309617

Article Last Modified on 12/6/2006

-

APPLIES TO


 * Microsoft Visual Basic 2005
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-



This article was previously published under Q309617





IN THIS TASK
SUMMARY
 * Description of the Technique
 * Upgrade an N-Tier Visual Basic 6.0 Application to Visual Basic .NET

REFERENCES



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

back to the top

Description of the Technique
If you upgrade a Visual Basic 6.0 project group or an n-tier application to Visual Basic .NET or Visual Basic 2005, 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:

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

If you want to change the .NET DLL, you must then close Visual Basic 6.0, recompile in Visual Basic .NET or in Visual Basic 2005, 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.</li></ul>

To upgrade each Visual Basic 6.0 application, use the Upgrade tool that is included with Visual Basic .NET or Visual Basic 2005. The Upgrade tool is started when you use Visual Basic .NET or Visual Basic 2005 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 or Visual Basic 2005 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.

back to the top

Upgrade an N-Tier Visual Basic 6.0 Application to Visual Basic .NET or Visual Basic 2005
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 or Visual Basic 2005.
 * 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 or Visual Basic 2005 client project still uses the business and data component from Visual Basic 6.0 through Interop. Similarly, the new Visual Basic .NET or Visual Basic 2005 business component project still references the data component from Visual Basic 6.0 through Interop.
 * 1) Upgrade the client component first. Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005, and open the Visual Basic 6.0 client project. The Upgrade Wizard is started.

NOTE: The Visual Basic .NET or Visual Basic 2005 Upgrade Wizard is included in Visual Studio .NET Professional or in Visual Studio 2005.


 * 1) Follow the steps in the wizard to create a new Visual Basic .NET or Visual Basic 2005 client project and an upgrade report.
 * 2) Review the upgrade report, which typically includes warnings about additional modifications that are required. Modify the new Visual Basic .NET or Visual Basic 2005 client project as recommended.
 * 3) Run the new Visual Basic .NET or Visual Basic 2005 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.
 * 4) Upgrade the middle tier (the business object). Open the Visual Basic 6.0 business object project in Visual Basic .NET or Visual Basic 2005, and complete the steps in the Upgrade Wizard.
 * 5) Review the upgrade report, and modify the new Visual Basic .NET or Visual Basic 2005 business component as recommended.
 * 6) Because the new Visual Basic .NET or Visual Basic 2005 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 or Visual Basic 2005 business component project.
 * 7) 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.
 * 8) Upgrade the final tier (the data access component). Open the Visual Basic 6.0 data access component project in Visual Basic .NET or in Visual Basic 2005, and complete the steps in the Upgrade Wizard.
 * 9) Review the upgrade report, and modify the new Visual Basic .NET or Visual Basic 2005 data access component as recommended.
 * 10) Delete any references to the Visual Basic 6.0 data access component in the Visual Basic .NET or Visual Basic 2005 business and client components, add references to the new Visual Basic .NET data access component project.
 * 11) Test the application to ensure that it works properly.

back to the top

<div class="references_section">