VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[INFO] Minor differences among different versions of Microsoft Windows Common Controls library

Each version of Visual Basic came with a different version of the Windows Common Controls (WCC) library. For example, VB5 came with WCC 5.0, whereas VB6 installed WCC 6.0. If you had developed a project using VB5 and WCC 5.0 and you then re-compiled the project under VB6, the project would continue to reference WCC 5.0. When migrating WCC controls to .NET, VB Migration Partner maps them to controls of its own CodeArchitects.VBLibrary DLL. These controls always mimick the behavior of the most recent version of WWC. In general, all WCC versions work in pretty much the same way, except for a few subtle differences.
  1. The ListItem and Node classes defined in WCC 5.0 are creatable, which means that the following statement is legal when using this WCC release
        Dim no As New Node, li As New ListItem
    It should be noted, however, that creating a Node or ListItem object made no sense in VB6, because assigning any property of the created object generates a runtime error. In practice using the New keyword with these classes is to be considered a programming error under VB6. If the original VB app contains these statements, odds are that they are inside methods that are never invoked. The Node and ListItem classes were marked as non-creatable in WCC 6.0 (the version VB Migration Partner emulates), therefore these statements woud generate a compilation error after the migration to .NET. If this is the case, you should manually edit the original VB6 code to remove the New keyword. Alternatively, you can use the following project-level pragma to automatically remove all “New” keywords used with the Node or ListItem classes:
        '## project:PreProcess "\bNew\s+(?(ComCtlLib\.)?(Node|ListItem))\b", "${type}"
    
    
  2. If you use WWC 5.0 and you have a control array of ListView controls, the Load method creates a new instance of the control that preserves only the column structure of the first element of the control array. Conversely, performing the same action with a ListView control of the WWC 6.0 library copies both the structure and the rows inside the control. Being based on WCC 6.0, VB Migration Partner generates applications that emulate the latter behavior (both the structure and the actual elements are copied). If you need to emulate the WCC 5.0 behavior, you just need to manually remove the elements after the control creation, as in this code:
        ListView1.Load(1)
        '## InsertStatement ListView1(1).ListItems.Clear()
    
Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers