Upgrade Philosophy

Upgrade Philosophy

When the Visual Basic .NET team decided to not support 100 percent Visual Basic 6 compatibility, the challenge to create a tool to upgrade any arbitrary Visual Basic 6 project to Visual Basic .NET was enormous. There was much debate within the team about what approach to take. Ultimately, the Visual Basic team adopted two overriding goals that can be summed up with the following statements:

It s your code.

Just make it work.

It s Your Code

The first goal of the Upgrade Wizard is to make the changes to your Visual Basic 6 forms and code as unobtrusive as possible. You should be able to recognize your code after the wizard has upgraded it. If the wizard transforms your code into an unintelligible pile of junk, you ll probably grab the closest person, point at your code, and say, Look what Microsoft did to my code. I m better off rewriting this whole thing myself. To avoid this situation, the Upgrade Wizard was designed with the goal of preserving your code as much as possible.

All of your comments should be preserved and in the same place they were before the upgrade. If you include #If Then directives, these will also be included in your upgraded project, and you should find them exactly where you put them, relative to everything else. The wizard tries to upgrade each element of your code language statements, controls, components, and ActiveX references to the elements in Visual Basic .NET that most closely match.

If, for example, the MsgBox statement exists in both Visual Basic 6 and Visual Basic .NET, the wizard will upgrade your code to use MsgBox. If there is no direct match, the wizard finds a language statement or component that most closely matches the element you are using. For example, all references to a CommandButton Caption property in code are upgraded to the .NET Framework equivalent, Button.Text property. If no element in Visual Basic .NET represents the same element in Visual Basic 6, the code is left as is, an UPGRADE_ISSUE comment is inserted above the nonupgraded code, and an issue is logged to the upgrade report.

Just Make It Work

The Upgrade Wizard strives to upgrade all your code from Visual Basic 6 to Visual Basic .NET in a way that allows you to run the upgraded application immediately after upgrade. This works for simple applications or applications that make use of only Visual Basic features that the wizard can upgrade. For larger, more complex applications, you ll need to fix some compiler errors and run-time issues that the Upgrade Wizard can t resolve.

This goal fits hand in hand with the It s your code objective. The best way to guarantee that your application will run the same after upgrade is to upgrade the application to use language statements, controls, and objects that behave identically in both Visual Basic 6 and Visual Basic .NET. For example, the Upgrade Wizard could choose to replace all instances of the Microsoft ListView ActiveX control in your application with the .NET Framework ListView control, but it doesn t. The wizard doesn t make this upgrade because by reusing the exact same component, that component and thus the application has a better chance of behaving the same as before. If the wizard were to replace your 20 ActiveX controls with 20 noncompatible .NET Framework controls, you would spend more time changing code to run your application. You can get your application up and running more quickly when the upgraded code contains language statements, controls, and objects that are compatible and most familiar to you. Once you get the application running, you can choose to incrementally replace code or components with .NET equivalents, and then test each change as you go.



Upgrading Microsoft Visual Basic 6.0to Microsoft Visual Basic  .NET
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET w/accompanying CD-ROM
ISBN: 073561587X
EAN: 2147483647
Year: 2001
Pages: 179

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net