Adding icons to listbox

L

Leonard

Hi

I have a listbox that shows resources I'm using in my teaching. I would like
the listbox to also show an icon associated with the resource (ie) if it is a
word doc show the Microsoft word icon.

Is this possible?

Many thanks

Leonard
 
D

Douglas J. Steele

And as soon as I typed that nothing came to mind, something did...

You could use a ListView instead. This is an unbound control that comes from
the comctl32.ocx control. Being unbound means you have to do a lot of extra
work to populate it, but it is capable of showing icons.

Randy Birch has extensive samples of using the ListView control at
http://vbnet.mvps.org/code/comctl/index.html with
http://vbnet.mvps.org/code/comctl/lvdemo4.htm specifically dealing with
adding icons.

Obligatory warning: Randy's site is aimed at VB programmers, not Access
ones. There are significant differences in the Form object between the two,
and many of his examples can't port directly into Access as a result of
that. I think the ListView examples should be okay as is, but I can't
guarantee that.
 
L

Leonard

Many, many thanks Doug.

I'll check this out - thanks for the warning about vb code rather than vba -
been caught a few times previously.

Leonard
 
Top