VB to .NET Frequently Asked Questions
The following is a compilation of frequently asked questions about ArtinSoft’s Visual Basic Upgrade Companion. It includes some inquiries about general VB to .NET migration issues, though that subject is extensively covered on our VB to VB.NET migration FAQ site. There’s also a general FAQ that covers information about the company, its technology and software migration in general.
General VB to .NET migration questions
Why should I upgrade my VB 6.0 applications to .NET?
There are several drivers for a VB to .NET migration:
- Integrate Windows, Web, Office and Mobile solutions
- Boost system performance
- Ease deployment
- Improve the maintenance of an application
- Increase developer productivity
- Consolidate your company's valuable software assets
- Ensure official support (support for VB 6 IDE ended on April 8th, 2008)
- Maintain competitive advantage over competitors
So, the decision can be justified by many factors, like technological constraints, legal/regulatory compliance requirements and lack of resources for older languages, all of which decrease an organization’s agility, boost operating costs and tend to destabilize its competitive position. In fact, in today’s fast-evolving, highly competitive markets, sometimes the alternative is to drop behind and go out of business.
Should I migrate to VB.NET or C#?
This is one of the most common questions people have when starting to consider a VB to .NET migration. Microsoft has clearly and continually stated that they are compromised with the future of both languages. They have done great efforts to ensure that both VB.NET and C# provide the full-power of the .NET Framework, though some might say that C# has been targeted at the more-code oriented developer, while VB.NET is aimed towards a developer who will work with the tool more extensively while crafting their code.
VB.NET and C# are Object Oriented programming languages, with full functionality for inheritance, interfaces, patterns and more inherent object oriented constructions and behavior. The existence of the .NET framework allows the use of types, libraries and more in both languages, which means that any programmer can read and write source code from any of these two languages without major issues, and the performance is the same thanks to the CLR (Common Language Runtime) environment. But of course there are differences between both languages that you should analyze, and in the end, the decision should be based on your available resources and customer demands. For example, if most of your developers have been working with VB 6.0 they will probably feel more comfortable adjusting to VB.NET. On the other hand, if you have a Java or C++ code base coexisting with your VB applications, it might be better to migrate your VB6 systems to C#, a language that is more comfortable for programmers exposed to some other object oriented languages due to its syntax, constructions and usability.
Should I migrate directly from VB 6.0 to C#, or is it reasonable to use a 2-step strategy (VB6 –> VB.NET –> C#)?
We’ve heard a few people suggesting a double path approach for those who chose to migrate their VB6 applications to C#. This suggestion mostly comes from those who offer a solution that only converts to VB.NET, and they even say it’s irrational to even think about jumping from VB6 to any .NET language other than VB.NET. Well, about half of our customers know better.
The differences between Visual Basic 6.0 and any .NET framework compliant language is totally noticeable, since, for starters, the former is a procedure intensive, non structured programming language which strongest feature was the “visual” designer used to build the graphical user interface, while the latter ones are fully Object Oriented.
This immense set of differences between VB6 and C# or VB.NET are estimated and resolved in most scenarios by ArtinSoft’s Visual Basic Upgrade Companion tool. To be more specific, let’s use some particular VB6 inherent feature, which is also present in VB.NET by the way: the “OnError Goto” construct, an unstructured error handling technique to jump to a specified code segment, and “OnError Resume Next”, used to continue with the next instruction in the source code in case there is an error. Both structures make more complex the path tracking for the application control during runtime, and complicate the debugging process and increases the time needed for the application maintenance because of its complexity and lack of readability. The VBUC is able to remove this error handling routines in the generated source code, ensuring the resulting source code will behave as much as object oriented as possible. The routine used to replace these structures is the “Try … Catch” blocks, simplifying the application flow path by having a managed interception of each error (exception). The “On Error GoTo” and “ResumeNext” constructs are not one-to-one equivalents with the “Try … Catch” block, but it is the simplest way to manage error occurrences without creating the same complexity effect found in the VB6 intrinsic routines.
The upgrade process from VB6 to C# is easier with the Visual Basic Upgrade Companion because of the considerations taken to ensure the resulting code’s quality will be the highest. Some of these considerations are strict typing, event declaration and invocation, error handling, refactoring from modules to classes, parameter transmission, arrays with lower bounds to zero, array dims and redims, default instances for forms, classes and user controls, indexer properties, “with” replacement for full naming, usage of return statements, interface creation for implemented classes, variable initialization, brackets and case sensitiveness refactoring, and more. After a deep analysis of the original source code, the Visual Basic Upgrade Companion is capable to perform all the refactoring and transformations needed to accomplish all the previously listed items, delivering the greatest levels of automation and taking the VB6 to .NET migration to higher levels of excellence.
All the Visual Basic 6 inherited features in VB.NET which C# lacks can be modeled with different constructions to accomplish functional equivalence. Using those alternate constructions the code will look more C# native instead of a bizarre adaptation from two extremely different programming paradigms.
All this means that a VB6 to VB.NET upgrade will consume the same effort than migrating to C#. The Visual Basic Upgrade Companion’s architecture allows the C# generation to be done directly from the analysis over the original VB6 source code, allowing the upgrade process to be done in one strike. This one-step migration avoids the use of 3rd party tools to do the final step from VB.NET to C# because the resulting code is built directly into C# and not in a VB.NET intermediate representation. A two-step migration will ruin the overall precision of the upgrade task because two different tools may differ in the code refactoring techniques, resulting in poor source code quality with almost no readability.
ArtinSoft has successfully upgraded millions of lines of code from VB6 to C#, and counting more everyday. Based on all this experience we can ensure you that a VB6 to C# migration is possible, reliable, and in fact, one of the most popular choices among large real world organizations.
Visual Basic Upgrade Companion
What is the Visual Basic Upgrade Companion?
The Visual Basic Upgrade Companion is ArtinSoft’s exclusive VB 6.0 to VB.NET or C# migration tool. This unique advanced tool provides a cost-effective solution that features ADO to ADO.NET conversion, variable type resolution ("late binding" problem), error handling replacement, use of .NET native libraries, code refactoring, third party component mappings, migration of mixed VB6 and ASP projects, multi-project upgrade support, and much more!
How does it differ from the Visual Basic Upgrade Wizard that ships with Microsoft’s Visual Studio?
Beside the ability to generate both VB.NET and C#, there are lots of features that make the Visual Basic Upgrade Companion a more powerful and unique tool. But basically, both tools have a common goal and a different nature.
The Upgrade Wizard automates the migration from VB6 to VB.NET by performing the refactoring needed to adapt most of the simplest expressions and commands found in Visual Basic 6.0. It also contains mappings from inherent VB6 libraries to .NET compliant equivalents. It’s a tool used to sketch the path to follow while upgrading from VB to .NET, working as an assistant to demonstrate all the challenges during the whole migration process. This way, the programmer will know where all the hardest spots while moving to the .NET framework are. Beside the issues identification, the VB Upgrade Wizard applies some automated translations over the VB6 code, and minimizes the time needed for the upgrade process by generating target source code.
Since the source and target languages are certainly different, there are many constructions and patterns that can’t be mapped one-on-one to .NET equivalents. On this scenario, the Visual Basic Upgrade Wizard generates an Upgrade Error, Warning or Issue (EWI) message about the item found and the particularity of the situation. In addition to the differences between both languages, the diversity of programming styles can result in many EWIs reported after the upgrade process.
So the main objective of the Visual Basic Upgrade Wizard is to start the migration process generating as much target source code as possible applying all the facts and techniques exposed previously, and in case there are particular scenarios without direct equivalents, the Upgrade Wizard can estimate the efforts needed to port this application to VB.NET by reporting the particular issue and its nature. If the source application is based on the enterprise context, the Upgrade Wizard might be able to assess small code segments, but it will not be able to upgrade in one strike real business applications because of its complexity and size.
That’s where the Visual Basic Upgrade Companion stands out. Long time ago, ArtinSoft realized the market required a tool capable of handling larger, more complex migration tasks, with all the implications this carries. Hence, the Visual Basic Upgrade Companion was conceived, incorporating the vast experience acquired by ArtinSoft during years of successful migration projects.
This is a tool capable of assessing several projects to deal with dependencies, which elevates the scope of the VB to .NET migration to higher levels of automation and precision. The Visual Basic Upgrade Companion’s architecture, scope, and target audience are extremely different from the Upgrade Wizard’s. It includes a really large amount of features to fit a real business application, like multi-project conversion and global preprocessing to solve renaming issues, interface creation, and more, just to mention a couple of them.
(Read a detailed comparison between the Visual Basic Upgrade Companion vs. the Upgrade Wizard)
Can the Visual Basic Upgrade Companion be customized?
Yes, ArtinSoft can develop both additional mappings to migrate third party components and additional customizations rules to convert programming patterns or structures so they become more ".NET-like". By customizing the Visual Basic Upgrade Companion according to the characteristics of your application and your target requirements the percentage of automated conversion is increased, thus reducing the manual effort required during a VB to .NET migration project.
How dependant is the converted code from support (helper) classes?
The migration philosophy behind the Visual Basic Upgrade Companion is to produce native .NET code with no dependency on the legacy platform or any third-party runtime, so that you can effectively take control of the evolutionary path of the migrated applications without any restrictions. To ensure this, the Visual Basic Upgrade Companion’s artificial intelligence-based engine generates VB.NET or C# code with the direct support of the .NET framework, but whenever this is absolutely not possible, due to API differences or code readability and maintenance, the tool makes use of support classes. However, you always have access to the library’s source code so that there’s no dependency on ArtinSoft.
Other VB to .NET migration tools rely heavily on extensive .dll libraries containing lots and lots of functions and classes that emulates Visual Basic 6 behavior in the .NET platform. For example, they generate one class per each VB6 control, so that every single control used in the migrated application is an instance to a class located in the proprietary library, without even one declaration of an inherent control; all the buttons, control arrays, text boxes, everything, is referenced to that library’s classes.
Building a .NET version of the VB6 environment may simplify the migration process by using those emulation functions and classes contained in the proprietary library, but this definitely compromises the final application’s maintainability. A helper library is meant to aid in the minor nip & tuck needed to get the original application running in .NET, not to “host” it. VB6 emulation in the .NET environment will keep all the patterns and constructions used in the source language, resulting in a poorly translated application which depends completely on this “support” library.
Besides getting access to all the new features found in the .NET framework, one of the main objectives of upgrading a given application from VB6 to .NET is to move into a fully supported environment. That’s why the Visual Basic Upgrade Companion generates source code as much .NET native as possible, using inherent controls, functions, constructions, keywords, etc.
What controls does the Visual Basic Upgrade Companion support?
The Visual Basic Upgrade Companion supports all the inherent VB6 controls and all of its properties, along with dozens of 3rd party libraries from different vendors. The tool includes a set of plug-in dlls designed to automatically convert functionality from ActiveX libraries to .NET libraries, thus saving an important amount of time in code analysis and manual modifications. Each plug-in dll contains the transformation specifications for each third-party library.
If there is a library employed in your application that has no equivalent in .NET it can be accessed through COM interoperability without many problems, but we can also customize the Visual Basic Upgrade Companion to generate the desired mappings to inherent .NET components or other 3rd party libraries.
For detailed information about supported controls and how they are upgraded to the .NET platform please contact us.
How effective is the Visual Basic Upgrade Companion at converting an application’s front end?
The Visual Basic Upgrade Companion actually does an outstanding job when upgrading the applications front end, thanks to the considerations taken like:
- Successful default properties extraction from the original VB6 controls
- Use of inherent .NET controls and constructions, which ensures the resulting graphical front-end will look as much natural as possible
- Absence of a proprietary runtime, which elevates the code maintainability and eases the process of future additions to the existing front end
- Clever implementations of upgrade issues like control arrays and default properties resolution even in late bound usages
- Extensibility model that allows the tool to adapt to particular code patterns and programming techniques
Also, during the conversion process, the Visual Basic Upgrade Companion will display all the conflicts and issues related to references to 3rd party libraries and other resources.
Can the Visual Basic Upgrade Companion convert VB6 native functions to .NET native functions?
Yes. There is a mechanism that allows the conversion of VB6 intrinsic library elements to .NET native libraries. This basic mechanism supports the following VB6 libraries:
- VB
- VBA
- VBRUN
- StdOle
- MSComCtlLib
How does the Visual Basic Upgrade Companion handle Windows API calls?
The Visual Basic Upgrade Companion uses two approaches to deal with API functions/types. The first method consists in leaving the code as it comes from VB6, and API functions will still be used in the converted code. Manual effort is required as certain Marshalling tasks could be necessary to pass managed data structures to the unmanaged code (API methods).
However, the Visual Basic Upgrade Companion provides a second approach where the final objective is to replace API members with .NET framework native functionality. Currently, the tool converts a subset of API members to .NET equivalents, but it can be extended by adding custom mappings for new API members.
For a comprehensive list of Windows API functions and their .NET equivalents, please refer to this MSDN page
How much does the Visual Basic Upgrade companion costs?
Pricing for the tool depends on the amount of lines of code to be migrated and the target language (VB.NET or C#). Besides, we offer 3 licensing options, varying in the level of training of support provided with each package: Bronze, Silver and Gold. Just contact us providing some info about your project, like application size and characteristics, desired target language, etc, and we will provide you with a non-obligation quote.