How to: Upgrade Visual Basic 6.0 Code with the Upgrade Visual Basic 6 Code Dialog Box

The Upgrade Visual Basic 6 Code dialog box is a tool that converts Visual Basic 6.0 code to equivalent Visual Basic 2008 code. Unlike the Visual Basic Upgrade Wizard, which upgrades an entire application, the Upgrade Visual Basic 6 Code dialog box is available at design time to convert small amounts of code as you are developing your Visual Basic 2008 application.

The Upgrade Visual Basic 6 Code dialog box is useful in two ways:

  • You can make use of existing Visual Basic 6.0 code by pasting it into the tool.

  • You can type in code using Visual Basic 6.0 syntax in order to learn the Visual Basic 2008 equivalent.

After running the tool, Visual Basic 2008 code is inserted into the Code Editor at the current cursor location. If there are any problems with the conversion, comments are inserted with clickable links to Help pages that explain the problem and any possible workarounds.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To upgrade Visual Basic 6.0 code

  1. In the Code Editor, move your mouse pointer where you want to insert code.

  2. On the Tools menu, choose Upgrade Visual Basic 6 Code.

    The Visual Basic 6.0 Code Upgrade dialog box is displayed.

  3. In the Visual Basic 6.0 Code Upgrade dialog box, paste existing Visual Basic 6.0 code, or enter code using Visual Basic 6.0 syntax.

    Note

    If you paste code that contains Unicode characters, a dialog will appear asking if you want to remove them. If you choose OK, the code will be parsed and any Unicode characters will be stripped out.

  4. If your code references a COM component, select the References tab and click Add Reference, then select the reference in the Add Reference dialog box.

  5. Click Upgrade to convert the code and insert it into the Code Editor.

    Any COM references will be added to the References node for your project in Solution Explorer, and a project-level Imports statement will be added for the Microsoft.VisualBasic.Compatibility namespace.

See Also

Reference

Upgrade Visual Basic 6 Code Dialog Box

Other Resources

Upgrading Applications Created in Previous Versions of Visual Basic