-
Does anyone know how I can put a picture(bmp or ico) in the first column of a listview control not in the heading but where the actual data is placed? I am using the report style because I want headers. What I want to do is put a small foler in the first column. Which tells me that this is a folder and not just a regular file. So some rows will have a folder in the first column and some will not.
-
I haven't used listview for a while, and i don't have vb on this comp but to listview.listitems(item).Image should be set the key or index you have from a picture in a imagelist that must be connected to the listview.
-
<?>
you have to add an image list to your form
set it's properties for the ico you will use
then set a reference from your listview to the imagelist
ie.
'set the list ctrl icon properties
'
listview1.Icons = imagelist1
-
HeSaidJoe,
How do you add the icon to the first column after you do the listview1.Icons = imagelist1 statement? I did this and see no icon in the listview control. I added one image to the imagelist control.
-
as i said:
Code:
listview1.listitems(iteminlistview).Image= iteminimagelist
the items should be either specified as keys, or index, that depends if you have them with or without keys.
-
<?>
[code]
'Sorry, busy day
'in this example lvwAddresses is the listview
'ilsSmallIcons and slsLargeIcons are 2 imageboxes
'one for large one for small icons
Dim itmAddress as ListItem
'set the list ctrl icon properties
'this initializes the image list
lvwAddresses.Icons = ilsLargeIcons
lvwAddresses.SmallIcons = ilsSmallIcons
'
'add columnHeaders..the width of the columns is
'the widht of the ctrl / 2 by the num of headers
'
Set hdrAddresses = lvwAddresses.ColumnHeaders.Add(, , "Name")
'add some data to the listitem (itmAddress)
Set itmAddress = lvwAddresses.ListItems.Add(, , "Kim & Deb", 1, 1)
itmAddress.SubItems(1) = "944-444-4444"
itmAddress.SubItems(2) = "44 who knows 44"
'
'note
'to omitt the icons remove the 1,1 form the statement
Set itmAddress = lvwAddresses.ListItems.Add(, , "Phil & Tony")
itmAddress.SubItems(1) = "444-055-5555"
itmAddress.SubItems(2) = "55 who knows 55"
[code]