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