Export (0) Print
Expand All

Lab 5: Using the Visual Basic Upgrade Wizard

Visual Studio .NET 2003
 

Visual Studio Team
Microsoft Corporation

August 2001

Summary: In this hands-on lab, you will learn how to upgrade an existing Microsoft Visual Basic 6.0 project to Visual Basic .NET using the Upgrade wizard. (8 printed pages)

Download the Experience Visual Studio .NET Lab files from the introduction topic.

Contents

Introduction
Opening the Visual Basic Upgrade Wizard
Using the Visual Basic Upgrade Wizard
Viewing the Upgrade Report
Viewing the New Project Files
Closing Out of Lab 5

Introduction

In this hands-on lab, you will learn how to upgrade an existing Microsoft Visual Basic™ 6.0 project to Microsoft Visual Basic .NET using the Upgrade wizard.

You will first open a Visual Basic 6.0 project within the Visual Basic design environment, and then you will upgrade this project to Visual Basic .NET using the Visual Basic Upgrade wizard and the Microsoft Visual Studio .NET Integrated Development Environment (IDE).

Opening the Visual Basic Upgrade Wizard

  1. Click Start, click Programs, click Experience VS.NET, click Lab5, and then click VB6SimpleUpgrade.vbp. The window shown in Figure 1 appears.

    Figure 1. Visual Basic 6.0 project in the Visual Basic environment

    Do not close this project, as it will be referenced later in this lab.

  2. Click Start, click Programs, click Microsoft Visual Studio .NET, click Microsoft Visual Studio .NET. The Start page in the Visual Studio .NET IDE appears as in Figure 2.

    Figure 2. Start page in the Visual Studio .NET IDE

  3. To open the Visual Basic 6.0 project and upgrade it in Visual Studio .NET IDE, click File, click Open, and then click Project.
  4. Expand C:\FieldContent\Experience VS.NET\Lab5.
  5. Click VB6SimpleUpgrade.vbp, and click Open. Page 1 of the Visual Basic Upgrade wizard appears as in Figure 3.

    Figure 3 Visual Basic Upgrade Wizard

Using the Visual Basic Upgrade Wizard

The Visual Basic Upgrade wizard guides you through the steps required to upgrade your Visual Basic 6.0 project to Visual Basic .NET. During the upgrade, the wizard also:

  • Creates a new project to which your project will be upgraded
  • Copies form and class files to the new project and converts them to the new format
  • Creates an upgrade report and adds it to your new project.
  • The following notes refer to specific pages in the Visual Basic Upgrade wizard:
    • Note   Page 1 of 5: The wizard tells you that Visual Studio .NET recognizes your current project as Visual Basic 6.0. Click Next to continue.
    • Note   Page 2 of 5: The wizard automatically detects whether your project is an executable file or a Microsoft ActiveX® DLL (the project used in this lab is an ActiveX DLL). Leave the default setting for the additional action question. Click Next to continue.
    • Note   Page 3 of 5: You can define the location where your new Visual Basic .NET project will be created. By default, the new project will be created in a subdirectory under your current project's path. Leave this default setting and click Next to continue. A warning box appears asking if you want to create a new folder for your project. Click Yes to continue.
    • Note   Page 4 of 5: The project is now ready to be upgraded. The time required to upgrade varies, depending on such factors as the size of your project and CPU memory. Click Next to begin the upgrade. Because this is a small project, the upgrade will take only a few minutes.
    • Note   Page 5 of 5: This page displays the status of the upgrade and appears only while the project is upgrading. When the upgrade is complete, the Solution Explorer window in the upper right section of the IDE screen is populated with your new project information.

      One of the new files, _UpgradeReport.htm, is the upgrade report. This report gives you more details about the upgrade process and informs you whether there were any errors during the upgrade.

Viewing the Upgrade Report

  1. In the Solution Explorer window, double-click _UpgradeReport.htm. The report opens in the main window as in Figure 4.

    Figure 4. Upgrade report

    Now that the upgrade is complete, you can compare and contrast the code in the Visual Basic 6.0 project and the upgraded Visual Basic .NET version.

  2. In the Solution Explorer Window, double-click cSimpleUpgrade.vb

    The source code for the Visual Basic .NET project appears in the main window.

  3. Scroll to the DateUpgrade method in the code.
  4. Switch back to the Visual Basic 6.0 IDE, and from the drop-down list box, select the DateUpgrade method.
    Note   There are similarities and differences in the code for each platform. Compare the DateUpgrade methods in each environment. Notice that Visual Basic .NET does not store dates as doubles, while Visual Basic 6.0 does. The .NET Framework provides the ToOADate and FromOADate functions to convert between doubles and dates. However, when your project is upgraded to Visual Basic .NET, it is difficult to determine the intention of code that uses doubles to store dates. To avoid unnecessary modifications to your code in Visual Basic .NET, always use the Date data type to store dates.

    Figures 5 and 6 show the similarities and differences between the DateUpgrade and ArrayUpgrade methods in the two environments.

    Figure 5. DateUpgrade and ArrayUpgrade methods in Visual Basic 6.0

    Figure 6 DateUpgrade and ArrayUpgrade methods in Visual Studio .NET

  5. To close Visual Basic .NET, click File, and then click Exit. When prompted to save changes to the project items, click Yes.
  6. To close Visual Basic 6.0, click File, and then click Exit. When prompted to save changes to the project items, click Yes.

    You can now view the new project files that were created during the upgrade process.

Viewing the New Project Files

  1. Click Start, click Programs, click Accessories, and then click Windows Explorer.
  2. Expand C:\FieldContent\Experience VS.NET\Lab5\VB6SimpleUpgrade VB.NET.

Closing Out of Lab 5

When you have finished viewing the project files, close all the windows.

Other articles and labs in the Experience Visual Studio .NET set include:

Introducing the Visual Studio .NET Lab Series

Lab 1: Hello World

Lab 2: XML Comments

Lab 3: ASP vs. ASP.NET

Lab 4: Server Controls Walkthrough

Lab 6: Building a Browser-Based Application

Lab 7: Inheritance and Override

Show:
© 2014 Microsoft