Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Problem with ImageList in VB5

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
emmle
Asked:
emmle
  • 2
1 Solution
 
dirtdartCommented:
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
 
emmleAuthor Commented:
It works! How did I miss it? Thanks very much for your time.
0
 
dirtdartCommented:
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

Technology Partners: 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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now