Solved

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

Posted on 2004-04-11
4
5,662 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
  • 2
  • 2
4 Comments
 
LVL 49

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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A short article about problems I had with the new location API and permissions in Marshmallow
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now