Finding the index of the item just added to a listview

Given certain conditions, I want to change the background colour of an item I have just added to a listview, but I cannot see how to get the index of the added item.

Who is Participating?
drichardsConnect With a Mentor Commented:
When you do the Add to the Items, a ListViewItem is returned to you.  You can check the Index property of the returned item, though it's not necessary since you already have the item in hand.

    System.Windows.Forms.ListViewItem item = listView1.Items.Add("New Item");
    // index of added item is 'item.Index'
graham_ballAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.