Adding icons to listbox

G

Guest

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.
 
G

Guest

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
 
Joined
Sep 5, 2018
Messages
1
Reaction score
0
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.
From my experience, ListView is much more usefull than listbox, but it does not work on Office 64 :( does anyone know how to enable ListView functionality for Office 64?
 

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