Solved

Problem with ImageList in VB5

Posted on 1997-10-17
3
337 Views
Last Modified: 2008-02-20
I am using an ImageList attached to a TreeView in order to display icons in the TreeView. I am populating the TreeView from a different form. When I try to add my first node to the TreeView, and select an Image from the ImageList, the message "ImageList must be initialized before it can be used".
I added 4 pictures to the ImageList at design time. Furthermore, I used to do the extract on the same form, and never had this problem before.

I then tried this:  Set MyFirstForm.MyImageList.ListImages(1).Picture = LoadPicture(gSYSPath & "\greenlit.ico") but I keep getting the message "Run-time error '383'; Property is read-only".
Any ideas?
0
Comment
Question by:emmle
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 20 total points
ID: 1438050
Right click on the tree view control and move to properties. On the General tab about halfway down, you will see an imagelist property. Make sure the name of the imagelist you are trying to use is in this box.  If not, select it from the dropdown list.   The error you are getting indicates that you just haven't told the treeview what imagelist to use.
0
 

Author Comment

by:emmle
ID: 1438051
It works! How did I miss it? Thanks very much for your time.
0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1438052
That's really simple to miss, so don't feel bad.  I once fought with a toolbar for a week because of this same situation.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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