In all VB Migration Partner versions up to and including 1.34 ImageList controls were converted into VB6ImageList controls (defined in VB Migration Partner’s support DLL), which in turn inherited from System.Windows.Forms.ImageList control. We later found that this arrangement prevented users from adding new images to the ImageList control at design-time, therefore in version 1.34 we changed the way this control is converted.
In version 1.34 and later versions, the ImageList control is translated to two different controls: an instance of the VB6ImageList control and an instance of the standard .NET ImageList control. For example, a VB6 control originally named MyImageList control is converted into the following controls:
- A CodeArchitects.VB6Library.VB6ImageList control named MyImageList
- A System.Windows.Forms.ImageList control named MyImageList_Control
The relationship between the two controls is established by assigning the MyImageList_Control object to the ImageList property of the MyImageList control. After the migration, users can edit all the images held in the native ImageList control from the Properties window, as they would do with a standard .NET form.
VB Migration Partner 1.34 and later versions automatically generates all the necessary statements in the code-behind portions of form classes, therefore in most cases you don’t need to be aware of these behind-the-scenes implementation details, with important one exception: if you migrated your forms with VB Migration Partner 1.33 (or earlier version) and then you replace the support library with the one that comes with VB Migration Partner 1.34 (or later version), then your .NET forms can’t be edited at design-time from inside Visual Studio.
The only workaround for this issue is by manually modifying the code-behind portions of forms that contain ImageList controls.
- Enable the “Show All” button in Solution Explorer window if necessary
- Inside the Solution Explorer, click on the “+” to the left of the form in question; this action reveals a file named yourformname.Designer.vb. Double click on it to edit the form’s code-behind portion
- Search for the statement that declares the MyImageList control; inserts the declaration of the MyImageList_Control variable immediately after it:
Public WithEvents MyImageList As CodeArchitects.VB6Library.VB6ImageList
Public WithEvents MyImageList_Control As System.Windows.Forms.ImageList
- Search for the statement that creates an instance of the VB6ImageList control (inside the InitializeComponent method); inserts the statements that instantiates the .NET ImageList control immediately after it:
Me.MyImageList = New CodeArchitects.VB6Library.VB6ImageList()
Me.MyImageList_Control = New System.Windows.Forms.ImageList()
- Scroll the code inside InitializeComponent method, until you find the statements that assign the ImageStream and Size properties of the MyImageList control and change the control reference so that the properties of the MyImageList_Control object are assigned instead:
Me.MyImageList.ImageStream = CType(resources.GetObject("MyImageList.ImageStream"), _
Me.MyImageList.ImageSize = New System.Drawing.Size(32, 32)
Me.MyImageList.ImageList = Me.MyImageList_Control
Me.MyImageList_Control.ImageSize = New System.Drawing.Size(32, 32)
- Save the file, close the form, and reloads it inside Visual Studio. The form should now display correctly at design-time.