Export (0) Print
Expand All

Preparing a Visual Basic 6.0 Application for Upgrading

Although the process of upgrading a Visual Basic 6.0 application to Visual Basic .NET 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 .NET. 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 .NET.

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. It is recommended 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 .NET 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 .NET.

Considerations for Forms and Controls

Visual Basic .NET 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 .NET 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 .NET. 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 .NET. Horizontal and vertical lines are upgraded to labels. Diagonal lines are not upgraded, and you should avoid using them.
  • Visual Basic .NET 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 .NET has two menu controls, MainMenu and ContextMenu, whereas Visual Basic 6.0 has one menu control that can be opened as either a MainMenu or a ContextMenu controls. All menu controls are upgraded to a single MainMenu component containing MenuItems for each menu control; you will have to recreate your ContextMenus and delete the extra MainMenu controls.

  • Visual Basic .NET has no support for Dynamic Data Exchange (DDE).
  • Visual Basic .NET does not support the Form.PrintForm method.
  • Although Visual Basic .NET 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.
  • The .NET Framework has an improved Clipboard object (System.Windows.Forms.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 .NET 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 System.Reflection classes.)

Data Recommendations

Visual Basic .NET 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.

DAO, RDO, and ADO can still be used in code from Visual Basic .NET, with some trivial modifications (covered in the language section of this document). However, Visual Basic .NET 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 .NET, 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 .NET 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.

For Web-based applications, applications that conform to the Microsoft multitier architecture guidelines, use Active Server Pages (ASP), and use Visual Basic 6.0 or Visual C++ 6.0 COM objects for business logic will be the easiest to upgrade. ASP is fully supported in Visual Basic .NET, 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 Studio .NET.

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

See Also

Things to Consider Before Upgrading | Why Upgrading is Necessary | Upgrading Applications Created in Previous Versions of Visual Basic | Language Recommendations for Upgrading

© 2014 Microsoft