Previous | Index | Next 

[HOWTO] Create an instance of the VB6ImageList control at runtime

In previous versions of VB Migration Partner it was possible to create a runtime instance of the VB6ImageList control by using code like this:

        Dim imgFolders As New VB6ImageList
        imgFolders.ListImages.Add(, "Open", LoadPicture6(App6.Path & "\FolderOpen.ico"))

(Please notice that this code cannot be the result of a migration, because you can’t instantiate an ImageList control in this fashion under VB6.)

Starting with version 1.34, this syntax isn’t supported any longer, because we changed the implementation of the VB6ImageList class, as explained in this KB article. To have the previous code work correctly you need to manually create a .NET ImageList control and assign it to the ImageList property that the VB6ImageList class exposes, as this code demonstrates:

        Dim imgFolders As New VB6ImageList
        imgFolders.ImageList = New ImageList()
        imgFolders.ListImages.Add(, "Open", LoadPicture6(App6.Path & "\FolderOpen.ico"))

 

Previous | Index | Next