ListView SubItem Icon

eidii

New member
Joined
Feb 3, 2007
Messages
3
Programming Experience
Beginner
I'm tryng to input an icon on a SubItem field.
I can do it on the first columm by:

VB.NET:
Expand Collapse Copy
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] itmp [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Windows.Forms.ListViewItem([/SIZE][SIZE=2][COLOR=#800000]"Luca"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] itms1 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Windows.Forms.ListViewItem.ListViewSubItem _
(itmp, [/SIZE][SIZE=2][COLOR=#800000]"Smile"[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2]ListView1.Items.Add(itmp)
[SIZE=2]itmp.SubItems.Add(itms1)
itmp.ImageIndex = 0
[/SIZE][/SIZE][/SIZE]

How can I paste an icon on the Subitem of the "Luca" Row? (itms1)
Thanks!!
 
ListViewItem only support displaying icons before the item+subs by setting the ImageIndex that reflects the ImageList assigned the ListView control.

Look into using DataGridView control that support DataGridViewImageColumn in any column order.
 
Back
Top