hi
i need to insert for each row in listview a diffrent image
how i can do it? when i try to do it i always see the sdame picture
thanks
have a nice day
Listview and image
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Ahmad Shaban6 pointsPosted Mar 25, 2006, 11:48 PM EST
To set a different icon to each listviewitem ( forget WORD row )
public void ImageGo( ListView MyView )
{
int MyNumber = 0;
foreach ( ListViewItem AnItem in MyView.Items )
{
AnItem.ImageIndex = MyNumber;
MyNumber++;
}
}
well the idea is each ListViewItem has an IconIndex
so if you have an ImageList that holds 4 Images then the first Icon has the Index = 0 then 1 and so on
so you need to assign a different index to each listviewitem (row)
this done by incrementing ++