imagelist1 and listview

G

Guest

Running vbexpress2005, I have a listview control with an imagelist1 set to
largeimagelist. There are 8 images in the index
The listview has 3 columns and I want an icon from the imagelist to appear
in the 1st column, some text in the 2nd column, and some more text in the 3rd
column.
The code below add the text to the columns


For Each proc In processes
itemAdd = ListView1.Items.Add(proc.MainWindowTitle)
itemAdd.SubItems.Add(proc.MainWindowHandler)
Next

What I dearly want to know is how do I go about adding the image from the in
the first column
Thanks
 
G

Guest

Take a look at my article at

http://www.knowdotnet.com/articles/iconsinlistview.html

Sorry that the code is in C# and you appear to be in VB.NET, but you should
be able to read it.

The lines of code, extracted from the article, listed below add one row to
the listview. The second line adds the listiviewitem, which is also the line
that adds the image to the first column. The second argument is the
ImageList index. You need a ImageList control in the ImageList property of
the ListView.

Visual Class Organizer shows extensive use of images in a listview..

HTH

Visual Class Organizer shows extensive use of images in a listview..

(e-mail address removed)

Try our latest time saving tool, Visual Class Organizer, free for 30 days.

http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html
 

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