imagelist filling at designtime

E

Ernst Schuurman

Hi XL-guru's

First I like to express my admiration for your expertise.
I read the posts in this NG for 5 months on a daily basis and I've learned
so much allready.
It's both interesting and educational to see how different approaches solve
one problem.
But now it's my turn to ask for your help.

I need to fill an imagelist with icons that I will use for a treeview in a
userform.
Using Ron de Bruin's Googlesearch I found an exellent example on Chip
Pearson's site.
Great tool that I use many times that Googlesearch.(thanks Ron)

From Chips example I could create my solution as disired, but I am lost on
this one:

the imagelist containing the icons is now filled at runtime.
Because in my application the imagelist contents will not change I want to
fill it once at disigntime.

I found some explanation on different sites, but can't reproduce it.

The dialog that should appear when you choose properties does not appear
when using an imagelist on a userform.
I do get this dialog when the imagelist is added to a worksheet, but I can
not cot/paste that to my userform.

Am I doing something wrong, or is there another explanation?

Kind regards,

Ernst
 
R

Rick Rothstein \(MVP - VB\)

I'm not sure if the ImageList control you are talking about is the one I
have available in my system or not. I have VB6 installed on my system (so
I'm not sure if it installed the ImageList control I'm using or not)... the
ImageList control that I get to add to the Toolbox is listed in the
Additional Controls dialog as...

Microsoft ImageList Control 6.0 (SP6)

If that is the one you are using, then when I add it my UserForm, the
Properties window has an entry named Custom which allows you to add images
at design time.

Rick
 
J

Jim Cone

Ernst,
In the properties window (for the ImageList control) in the VBE,
select "Custom". The Property Pages form for the ImageList pops up.
Insert your pictures on the Images tab.
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Ernst Schuurman"
wrote in message
Hi XL-guru's

First I like to express my admiration for your expertise.
I read the posts in this NG for 5 months on a daily basis and I've learned
so much allready.
It's both interesting and educational to see how different approaches solve
one problem.
But now it's my turn to ask for your help.

I need to fill an imagelist with icons that I will use for a treeview in a
userform.
Using Ron de Bruin's Googlesearch I found an exellent example on Chip
Pearson's site.
Great tool that I use many times that Googlesearch.(thanks Ron)
From Chips example I could create my solution as disired, but I am lost on
this one:
the imagelist containing the icons is now filled at runtime.
Because in my application the imagelist contents will not change I want to
fill it once at disigntime.
I found some explanation on different sites, but can't reproduce it.
The dialog that should appear when you choose properties does not appear
when using an imagelist on a userform.
I do get this dialog when the imagelist is added to a worksheet, but I can
not cot/paste that to my userform.
Am I doing something wrong, or is there another explanation?
Kind regards,
Ernst
 
E

Ernst Schuurman

Hi Rick,

Thank you for your response.
I am using then Microsoft ImageList Control 6.0 (SP6)
I just found that before adding the control to the userform I can get the
dialog by using custom in the right click menu from the userforms toolbar.
but when typing the following line into the immidiate window after stepping
into the first line of the UserForm_Initialize procedure

?ImgLijst.ListImages.Count

I get 0 as result. where ImgLijst is the imagelist's name.

starting the userform results in an errormessage:

ImageList must be initialised before it can be used.

So that gives me the impression that there are not realy pictures added.

I am sure I've added 5 pictures to the ImageList before I added it to the
userform.

And when it is added to the form I see no custom option anymore.

So I must do something wrong, but I am not sure what.
 
R

Rick Rothstein \(MVP - VB\)

As a test, after going to the Image tab on the Custom dialog for the
ImageList control and Inserting two BMP pictures, I added...

Private Sub UserForm_Initialize()
Debug.Print ImageList1.ListImages.Count
End Sub

to the UserForm's code window and ran the program... it printed 2 to the
Immediate window.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top