Preparing a Visual Basic 6.0 Application for Upgrading

Although the process of upgrading a Visual Basic 6.0 application to Visual Basic 2008 is for the most part automatic, there are a number of things you can do to optimize your upgrade with a little bit of preparation.

By following the recommendations in this topic, you can minimize and, in some cases, eliminate the changes needed after upgrading your project to Visual Basic 2008. In most cases, the recommendations simply represent good programming practices; however, some also identify the objects and methods which have no equivalents, and which should be used sparingly if you intend to upgrade your project to Visual Basic 2008.

General Recommendations

This may seem obvious, but if your project doesn't compile and run under Visual Basic 6.0, it will not be upgraded successfully. We recommend that you install Visual Basic 6.0 on the computer that you will be using for upgrading. In addition to allowing you to test the application, this will ensure that all necessary controls, components, and type libraries are available during upgrade.

Visual Basic 2008 allows you to upgrade Visual Basic 6.0 projects; if you have a project written in Visual Basic version 1 to 5, you should first load it into Visual Basic 6.0 (choosing to upgrade Microsoft ActiveX controls), compile, and save the project before upgrading it to Visual Basic 2008.

Considerations for Forms and Controls

Visual Basic 2008 has a new forms package, Windows Forms. Windows Forms is largely compatible with the forms package found in Visual Basic 6.0; however, there are some key differences that are outlined below:

  • Visual Basic 2008 does not support the OLE container control; you should avoid using this control in your Visual Basic 6.0 applications.

  • There is no shape control in Visual Basic 2008. Square and rectangular shapes will be upgraded to labels, while ovals and circles cannot be upgraded. You should avoid using these in your applications.

  • There is no line control in Visual Basic 2008. Horizontal and vertical lines are upgraded to labels. Diagonal lines are not upgraded, and you should avoid using them.

  • Visual Basic 2008 has a new set of graphics commands that replace the Form methods Circle, CLS, PSet, Line, and Point. Because the new object model is quite different from Visual Basic 6.0, these methods cannot be upgraded.

  • For the Timer control, setting the Interval property to 0 does not disable the timer; instead the interval is reset to 1. In your Visual Basic 6.0 projects, you should set Enabled to False instead of setting the Interval to 0.

  • Visual Basic 2008 has two menu controls, MenuStrip and ContextMenuStrip, whereas Visual Basic 6.0 has one menu control that can be opened as either a MainMenu or a ContextMenu control. All menu controls are upgraded to a single MenuStrip component containing MenuItems for each menu control; you will have to recreate your context menus and delete the extra MenuStrip controls.

  • Visual Basic 2008 has no support for Dynamic Data Exchange (DDE).

  • Visual Basic 2008 does not support the Form.PrintForm method.

  • Although Visual Basic 2008 has support for drag-and-drop functionality, the object model is different from the one in Visual Basic 6.0. Therefore, the Visual Basic 6.0 drag-and-drop properties and methods cannot be upgraded.

  • Visual Basic 2008 has an improved Clipboard object (My.Computer.Clipboard) that offers more functionality and supports more Clipboard formats than the Visual Basic 6.0 Clipboard object. However, because of differences between object models, Clipboard statements cannot be automatically upgraded.

  • Visual Basic 2008 does not support the Name property for forms and controls at run time; therefore you should not write code that iterates the Controls collection looking for a control with a certain name. (This functionality is now available using the .NET Framework System.Reflection classes.)

Data Recommendations

Visual Basic 2008 introduces an enhanced version of ADO called ADO.NET that is optimized to work with data in distributed applications and that provides performance improvements over ADO when used in distributed applications.

RDO and ADO can still be used in code from Visual Basic 2008, with some trivial modifications. However, Visual Basic 2008 does not support DAO and RDO data binding to controls, data controls, or RDO User connection. We recommend that if your applications contain DAO or RDO data binding you either leave them in Visual Basic 6.0 or upgrade the DAO or RDO data binding to ADO before upgrading your project to Visual Basic 2008, as ADO data binding is supported in Windows Forms. Information on how to upgrade DAO or RDO to ADO in Visual Basic 6.0 is available in the Visual Basic 6.0 Help.

Web Architecture Recommendations

Visual Basic 2008 introduces ASP.NET, an enhanced version of ASP, and adds to the architecture with Web Forms, a technology for producing Web pages with a Visual Basic-like event model. The architecture is server-based.

Web-based applications that meet the following criteria will be the easiest to upgrade:

  • Follow Microsoft multitier architectural guidelines.

  • Use Active Server Pages.

  • Use Visual Basic 6.0 or Visual C++ 6.0 COM objects for business logic.

ASP is fully supported in Visual Basic 2008, and you can continue to extend your application using ASP, ASP.NET, and Web Forms. The Visual Basic 6.0 and Visual C++ 6.0 business objects can either be used without modification or upgraded to Visual Basic 2008.

Webclasses no longer exist in Visual Basic 2008. Existing Webclass applications can interoperate with Visual Basic 2008 Web Forms and ASP applications, or they can be upgraded to Web Forms applications.

See Also

Concepts

Things to Consider Before Upgrading

Why Upgrading Is Necessary

Other Resources

Upgrading Applications Created in Previous Versions of Visual Basic

Language Recommendations for Upgrading