How does the VBUC handle VB6 Collections?

Subject

VB6 Collections Migration

Applies to

Migration; Collection; HashTable; ArrayList;StringCollection; StringDictionary

Inquiry Description

The VBUC can migrate VB6 Collections to the following .NET data types, depending on their usage in the original VB6 code: StringCollection, StringDictionary, ArrayList and HashTable. This is a good alternative to the backward compatibility VB6.Collection class, but may lead to numerous manual changes if the usage of Collections in the VB6 source code is not uniform.

Troubleshooting/solution

VB6 Collections could be indexed with either a string key (HashTable-style) or an integer (ArrayList-style). In .NET, we have HashTables that can be indexed with a key and ArrayLists that can be indexed with integers, but we don't have this "hybrid" class that can have both types of access.

When you migrate, the VBUC can detect the way in which you are accessing Collections in your code and based on that, it infers the appropriate replacement. However, for this inference to work correctly in all cases, the usage of each Collection in VB6 must be very uniform and consistent throughout the code (i.e. you can't mix ArrayList-like and HashTable-like access on the same instance of a Collection). Furthermore, if a VB6 Collection contains only String objects, the VBUC may convert that collection to the .NET StringCollection class (for ArrayList-like access) or to the .NET StringDictionary class (for HashTable-like access).

This is a good alternative to the backward compatibility VB6.Collection class (the default conversion for Collections in the VBUC), but may lead to numerous manual changes if the usage of Collections in the VB6 source code is not uniform.

If the conversion of VB6 Collections is generating numerous compilation errors, it is recommended to disable the "VB6.Collection Special Maps" Code Conversion Rule from the Upgrade Profile configuration window. This is also the default VBUC setting for this option. With this setting turned off, VB6 Collections are converted to the VB6.Collection class, which allows both the "ArrayList-like" and the "HashTable-like" types of access.


Submitted date

8/17/2009 1:16:38 PM


Related FAQs

None

Skip Navigation Links.
Expand ArtinSoft Visual Basic Upgrade Companion (VBUC)ArtinSoft Visual Basic Upgrade Companion (VBUC)
Expand VBUC Getting StartedVBUC Getting Started
Collapse Migration Knowledge BaseMigration Knowledge Base
Expand VBUC Errors, Warnings and IssuesVBUC Errors, Warnings and Issues
Collapse VBUC Frequently Asked QuestionsVBUC Frequently Asked Questions
Collapse General QuestionsGeneral Questions
Error 2869 during the VBUC installation
How effective is the Visual Basic Upgrade Companion at converting an application's front end?
Expand What controls does the Visual Basic Upgrade Companion support?What controls does the Visual Basic Upgrade Companion support?
Can the Visual Basic Upgrade Companion be customized?
How does the VBUC handle VB6 Collections?
How does the VBUC convert ADO to ADO.NET?
Visual Basic Upgrade Companion customization options
FAQ: What is the process to upgrade from VB5 to .Net?
ActiveX/User documents migration workaround using the VBUC
Property Page migration workaround using the VBUC
How to install the VBUC Developer Edition successfully
Is the Artinsoft.VB6.dll helper class library redistributable?
What are the code changes and other activities required before migration?
XSL operations and MSXML library migration
VBUC generated Visual Studio solution file version
Where is the source code for the support (helper) classes used by the VBUC?
How effective is the Visual Basic Upgrade Companion at converting an application's front end?
VBUC Developer Edition Offline Activation Process
What’s the difference between the License File and the Activation File
Do the VBUC migrate intrinsic VB6 functions and libraries?
Error : Retrieving the COM class factory for component with CLSID {11C67C12-105A-4F42-A5C8-CB9070F2855A} failed due to the following error: 80040154
Expand HOW TOHOW TO