We help IT Professionals succeed at work.

The "ImageList must be initialized before it can be used" VB 6.0 error

k0ndi
k0ndi asked
on
Medium Priority
5,888 Views
Last Modified: 2012-08-14
Hello!

I have a VB 6.0 problem. Let's go through step by step:
1. I add Microsoft Windows Common controls 6.0(SP4)
2. I add these 3 components on the form:
      imageCombo1 representing ImageCombo control
      imageList1 representing ImageList control
      command1 representig a CommadnButton.

Let's look at the code:

Private Sub Command1_Click()
   ImageList1.ListImages.Add 1, "ImageKey", LoadPicture("c:\test.bmp")
   ImageCombo1.ComboItems.Add 1, "ItemKey", "This is a test item", "ImageKey"
End Sub

Now when pressing the command button I get this error : "ImageList must be initialized before it can be used"

Thanks for all your help.

Regards,
Peter


Comment
Watch Question

Software Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Worked like a charm. Shame on me :-)
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Glad could make help :-) yet any reason why a "B" is awarded instead?

Author

Commented:
Sure! You mistyped yourself. I knew what you meant instantly, but someone could have problems with it for about 10 seconds :-) I had to rightclick the ImageCombo not Imagelist. No offence.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.