The automated language transformations shorten the manual changes stage by offering a higher quality, straight-out-of-the-box source code. These transformations also increase the resulting product maintainability by adapting inherent .NET constructions from legacy structures to create pure and readable .NET code.
There are many technical challenges during the VB6 to .NET migration stages, which demands many analysis and assessments, but so are the techniques to solve these inconveniences. The Visual Basic Upgrade Companion transforms many legacy constructions to their .NET revamped equivalents. Some examples are described below.
.NET Native Libraries instead of Visual Basic Compatibility Libraries
Whenever possible, the Visual Basic Upgrade Companion upgrades the VB6 libraries (i.e. VBA, VB) to .NET native equivalents, instead of using the Visual Basic Compatibility Libraries.
The Visual Basic Upgrade Companion produces .NET code with minimal usage of Microsoft’s Visual Basic Compatibility Runtime Library. While Mobilize.Net does not disagree with the use of this library, this more sophisticated approach is based on the following guidelines:
- Performance: native methods are faster. The compatibility methods check for old VB6 behavior during runtime execution instead of a static analysis as VBUC does.
- Maintainability: VB.NET allows old VB syntax to be used. With the Compatibility Runtime Library, for example, a developer can write Len(strVariable) instead of strVariable.Length. The resulting code is more difficult to read and maintain.
VB6 constants and numeric literals to .NET enumerations
A common practice in VB6 is to assign numeric literals to control properties. The Visual Basic Upgrade Companion replaces these literals with the .NET enumeration equivalents, so that the generated code is more legible and maintainable.
The Visual Basic Upgrade Companion will assign the corresponding .NET constant even when the programmer uses the wrong constant, helping remedy a common mistake in VB6. For instance, VB6 programmers frequently use a constant of FileAttibutes enumeration instead of the MousePointer enumeration. In VB6 this is not a problem because vbNormal and vbDefault have the same integer value.
User Controls and custom properties
The Visual Basic Upgrade Companion supports VB6 user controls and its custom properties. The upgraded version of the control can be edited and configured through the forms designer in the Visual Studio .NET Environment.