VB Migration Partner

KNOWLEDGE BASE - General


Previous | Index | Next 

[HOWTO] Incrementally migrate a large VB6 project and avoid the “Maximum number of errors has been exceeded” message

One of the serious problems when migrating large VB6 projects is that the resulting .NET project just contains too many compilation errors and they can’t be displayed in Visual Studio’s Error List window. In such cases it’s impossible to incrementally migrate and test the application. This article illustrates a simple migration technique that allows you to work around this problem.

Starting with version 1.31, VB Migration Partner supports a special pragma that automatically remarks all the statements inside a method body. You typically enable this option at the project level but disable it in selected forms, classes, and modules.

For example, let’s assume that you want to initially focus your migration efforts on the general purposes methods defined inside the Functions.bas module. You can achieve this by using these two pragmas at the top of the module itself:

        '## NOTE remark all methods in all files, except current file
        '## project:SetOption RemarkMethodBody, True
        '## SetOption RemarkMethodBody, False

The SetOption RemarkMethodBody pragma automatically comments all statements inside methods in all files except the current one. For example, here’s how a method might look like if it falls under the scope of the pragma:

        Public Function DoubleIt(ByVal x As Single) As Single
            ' EXCLUDED: Dim res As Single = x * 2
            ' EXCLUDED: Return res
        End Function

Because it doesn’t remark also the method signature, all method and property references are correctly resolved, even if the call to that method or property actually does nothing. The important point is that you can work on a reduced number of compilation errors – that is, only those inside the Functions.vb module - and can start fixing them.
 It is essential that you fix all the problems in Functions.vb exclusively by means of pragmas, so that your fixes will survive all subsequente migrations.

When all the compilation errors in Functions.vb have been fixed, you can turn your attention to another class or module, say the Widget class. To do so, just add this pragma at the top of the Widget.cls source file and re-run VB Migration Partner:

        '## SetOption RemarkMethodBody, False

Instead of disabling this option at the file level, you can focus on single methods by inserting the pragma inside the method itself, as in this example:

        Public Function DoubleIt(ByVal x As Single) As Single
            '## SetOption RemarkMethodBody, False
            ...
        End Function

Or you can just use Visual Studio’s Find and Replace command to eliminate the ' EXCLUDED prefix in front of each remarked line.

Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers