Can't seem to be able to set ListViewItem.imageIndex
I have been scratching my head with this error for at least an hour, what the heck is wrong here?
In a loop:
if (selectedItems[x].ImageIndex == 3)
{
List<ListViewItem> dupes = CP.listCache.FindAll(delegate(ListViewItem item) { return item.Text == selectedItems[x].Text; });
if (dupes != null &a开发者_如何学运维mp;& dupes.Count == 1)
dupes[0].ImageIndex = 0;
}
I can access the imageIndex, but not set it. ArgumentOutOfRange exception occurs.
Make sure you know what what's throwing your ArgumentOutOfRange exception -- that's your first problem. Is x a valid index into selectedItems? Is the index you're setting into your image list valid? Remember, indexes are zero-based, not 1-based.
精彩评论