Solved

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

Posted on 2004-04-11
4
5,682 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


0
Comment
Question by:k0ndi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 250 total points
ID: 10801470
Right Click the ImageCombo1 Control, then go to the Properties, at the ImageList drop-down, select the ImageList1. Then try run your code again, it should works now.

cheers
0
 

Author Comment

by:k0ndi
ID: 10801557
Worked like a charm. Shame on me :-)
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 10801660
Glad could make help :-) yet any reason why a "B" is awarded instead?
0
 

Author Comment

by:k0ndi
ID: 10802142
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.
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question