The current version of VB Migration Partner takes the following steps when it migrates a form that contains an unsupported ActiveX control named XYZ:
- it creates a form-level object variable named XYZ. This variable serves to make the VB.NET compiler happy, because it can resolve all references to the control in code.
- it creates a VB6Placeholder control named XYZ_Placeholder; this control appears as a red rectangle in the designer and at runtime, and indicates where the unsupported control was located on the original form.
We decided to adopt this strategy in order to reduce the number of compilation errors and enable developers to have an executable application in less time, although not fully functional. Clearly, any attempt to access a property or call a method on the XYZ variable causes an exception to be thrown at runtime.
We render unsupported controls as red placeholders not only to give a visual clue of controls that weren’t migrated, but also because some unsupported controls work as container controls. A common example of this is the Coolbar control used to host toolbars or other controls. The VB6Placeholder control does support child controls, therefore it is possible to test these child controls even if the container control hasn’t migrated correctly.