I forgot to mention that you should create columns for each sub item that
you are adding to a list view item. If you set the view property of the list
view to Details you should be able to see all the data that you have added to
the list view.
listView1.Columns.Add("Privilege");
listView1.Columns.Add("Details");
System.Drawing.Icon myIcon = new System.Drawing.Icon("Icon1.ico");
ImageList myImageList = new ImageList();
myImageList.Images.Add(myIcon);
listView1.SmallImageList = myImageList;
for (int i = 0; i < 5; i++)
{
ListViewItem lstviUser = new ListViewItem(i.ToString(),0);
lstviUser.SubItems.Add(i.ToString() + " S");
listView1.Items.Add(lstviUser);
}
Adrian.
--
[Please mark my answer if it was helpful to you]
"giddy" wrote:
hi,
I have a listview on a form, the View is set to Tile. I also have an
image list tied to the *smallImageList property, i have one image in
the image list, its a png : 32X32
When i do this, i dont see an icon and the SubItem text!
lstvUsers.Columns.Add(Privilege");//added only so the tile detail is
visible
foreach (User _user in _users.Users)
{
ListViewItem lstviUser = new
ListViewItem(_user.Username,"User.png");
lstviUser.SubItems.Add(_user.Privilege.ToString()) ;
lstvUsers.Items.Add(lstviUser);
}
When i added my imagelist to the largeImageList property the icon
shows up. BUT I still dont see the subitem text!? What am i doing
wrong!!!!
Gideon