Reputation: 2685
Unfortunately I need to make changes to an old VB6 application. I have noticed that the image combo from mscomctl.ocx does not work correctly in Windows 7. No images are displayed, even though it is linked to an imagelist control, and worked fine in XP.
Does anyone know why this might have broken in Win 7 and suggest a fix?
Upvotes: 0
Views: 1703
Reputation: 11
MSCOMCTL.OCX
6.1.97.82 Works 6.1.98.33 Doesn't work
It's da' version
try with 6.1.97.82
I Got it!
In version 6.1.98.33, when you add items to comboitems collection, you have to set the third parameter ("Text"). Then the image will be shown. You can set an empty string "".
Upvotes: 1
Reputation: 5689
Well, the following worked for me where ImageCombo was my ImageCombo box, and ImageList was my Image List control!
Private Sub Command_Click()
Set ImageCombo.ImageList = ImageList
With ImageCombo.ComboItems
.Add , "OPEN_FOLDER", "Open Folder", "IMG_OPEN_FOLDER"
.Add , "CLOSED_FOLDER", "Closed Folder", "IMG_CLOSED_FOLDER"
.Add , "NEW_DOCUMENT", "New Document", "IMG_NEW_DOCUMENT"
.Add , "PLUS", "Plus", "IMG_PLUS"
.Add , "MINUS", "Minus", "IMG_MINUS"
End With
End Sub
IMG_xxxx are my image list keys.
Upvotes: 1
Reputation: 2685
Simply assigning the image list to the combo is not enough! One needs to add the items too:
ImageCombo1.ComboItems.Add 1, "key1", "text1", 1
ImageCombo1.ComboItems.Add 2, "key2", "text2", 2
And then you have to remember what binary compatibility is when deploying. Gosh, the progress we've made since VB6... long live .Net.
Upvotes: 0
Reputation: 8141
Perhaps MSCOMCTL.OCX isn’t correctly registered or that it isn’t compatible with your Windows. Please open a Command Prompt and run as Administrator, then type the following command:
Regsvr32 MSCOMCTL.OCX
If the issue still persists, download a new MSCOMCTL.OCX and register it again. You can download the MSCOMCTL.OCX from the following link: Mscomctl.zip
Upvotes: 0