Solved

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

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

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 50

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article will show, step by step, how to integrate R code into a R Sweave document
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 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