Previous | Index | Next 

[HOWTO] Migrating VB6 reports to NET

VB Migration Partner supports migration of DataEnvironment designer, but not other kinds of reports that you can define directly in VB6.
Here are some hints for migrating common kind of reports used in VB6:

Microsoft Data Report (*.dsr)
If your application use Microsoft Data Report (*.dsr) reports, unfortunately no conversion is possible: there is no automatic conversion tool to perform the migration.
The easiest way to avoid compilation errors in your migrated application is by remarking out all the statements that contain a reference to Data Report or other unsupported designers.

For more information, please read the following article:
[HOWTO] Avoid compilation errors caused by unsupported designers.

Crystal Reports
Following notes have been tested with Crystal Reports version included in Visual Studio.

Good news for Crystal report users: no errors during migration have been observed.
If your VB6 application uses Crystal Report OCX component, before migration consider to add crystl32.ocx as a reference (remember to remove every Crystal Report control, placed on VB6 form before unchecking component reference), declare a new CrystalReport object when required and set all its properties, modified in VB6 designer, in the Form_Load, as follows:

In this way, you don’t need to create extra OCX wrapper class (by using AxWrapperGen tool, because no visual control is included in Crystal Report Control 4.6 ActiveX library).
After the migration, you should see your report exactly as in VB6 at runtime, *but* no subsequent changes (or updates) will be allowed in Visual Studio .NET because imported Crystal Reports files are saved in an obsolete format.

Fortunately, Crystal Report for Visual Studio allows importing of report saved in old VB6 format. Therefore, upgrading old CR report is possible but manual fixes to .NET code (which uses CR) are required.
To perform this “manual” migration with smallest effort, it’s advisable to extract all code that uses CrystalReport object in a separate module *before the migration*; in this way, you can use:

    '## SetOption RemarkMethodBody

The SetOption pragma correctly resolves method references without having to fix individual statements related to COM Crystal Report objects that cause a compilation error and replacing them with .NET CR references.

Here are steps to upgrade old reports:

  1. In the Visual Studio .NET Solution Explorer, right-click your migrated project to display the shortcut menu.
  2. Point to Add and click Add New Item.
  3. In the Add New Item dialog box, select Crystal Report from the Templates area. Click Open.
  4. In the Crystal Report Gallery, select From an Existing Report and click OK:

  5. Select old CR report:



    After this, your VB6 report is available in Visual Studio and all CR .NET assemblies are automatically added to your migrated project:



 

Previous | Index | Next