Solved

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

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

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 51

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

730 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