Microsoft KB Archive/194910

= FIX: Cannot Set ImageList for ImageCombo at Design on MDIForm =

Article ID: 194910

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q194910



SYMPTOMS
An ImageCombo control on an MDIForm initially appears empty. Even when an item is selected from the drop-down list it does not display any images.



CAUSE
When on an MDIForm, the ImageCombo does not initially bind to its ImageList nor does it display its text. So the image(s) does not appear if the ImageList property of the ImageCombo was set at design-time.



RESOLUTION
To make the image(s) appear, set the ImageList property of the ImageCombo at run-time when on an MDIForm. To make the text display, set the focus to the ImageCombo. Note that making the ImageCombo's TabIndex = 0 will not work.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio 6.0 Service Packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps To Reproduce
 Create a Standard EXE project in Visual Basic. Form1 is created by default. Select Components from the Project menu, select Microsoft Windows Common Controls 6.0," and click OK. Add an MDIForm, MDIForm1, to the project. Choose Properties from the Project menu and make MDIForm1 the Startup Object. Place a PictureBox onto MDIForm1.</li> Place an ImageList control and an ImageCombo into the PictureBox.</li> Alternate-click on ImageList and select Properties. Select the  tab and insert an image into the ImageList.</li> From the Custom Properties of the ImageCombo, set the ImageList property to ImageList1.</li>  Place the following into the MDIForm's module:      Private Sub MDIForm_Load         ImageCombo1.ComboItems.Add, "Key1", "Test", 1, 1         ImageCombo1.SelectedItem = ImageCombo1.ComboItems(1)      End Sub                    </li> Run the project and note that the ImageCombo is initially blank.</li> Try to pick the item from the list. Note that at no time does the image appear, but the Text appears after the list has been dropped.</li> Close the project.</li>  Change the code above (from step 9) to the following: Private Sub MDIForm_Load ImageCombo1.ImageList = ImageList1  ' set ImageList at run-time ImageCombo1.ComboItems.Add, "Key1", "Test", 1, 1 ImageCombo1.SelectedItem = ImageCombo1.ComboItems(1) Me.Show ' Show now rather than after this event finishes ImageCombo1.SetFocus ' This makes the Text appear End Sub </li> From the properties window of the ImageCombo, set ImageList to <None>.</li> Run the project and note that the image and text now immediately appear in the ImageCombo.</li></ol>

Keywords: kbbug kbfix kbctrl kbvs600sp3fix KB194910

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.