Listview help

tamandt

Member
Joined
Apr 1, 2006
Messages
13
Programming Experience
3-5
What I am trying to do is get a checkbox, and icon, and a few columns of information into a control.

The data will include (not limited to). An icon from an exe or dll. the name, the path. etc...

How do i get the image to show up on the listview... assuming i know that the first item in listview should use the first image in my imagelist......

VB.NET:
Expand Collapse Copy
      IcoList.Images.Add(Icon.ExtractAssociatedIcon("C:\windows\notepad.exe"))
        Me.FileList.SmallImageList = IcoList
        StartupList.Items.Add(IcoList.Images.Count.ToString)
        Me.FileList.Items.Add("Hello")
        PictureBox1.Image = IcoList.Images(0)

I am able to change a picturebox to the icon.. but do not know how to set images within the listview....

Basically each row of data will need:

Check box -> Icon -> Name -> Path -> Parameters -> etc....

I also am unsure how to see if checkbox is checked, although I havent even tried looking for that part yet.

Anyway... I haven't done much programming in .net and ive never used a listview, so any help would be appreciated...

Thanks....
 
Last edited by a moderator:
You should read the documentation for the ListView class and related classes that you may encounter, especially the ListViewItem class and the ListView.ListViewItemCollection class.

ListView image index can be set with either of these options:
  • one of the ListViewItem constructors
  • ListViewItem.ImageIndex property or ListViewItem.ImageKey property
  • one of the ListView.ListViewItemCollection.Add methods (accessed with lv.Items.Add(...))

ListViewItem.Checked property will tell is a ListViewItem is checked. You can also use the ListView.CheckedItems collection.
 
Back
Top