2
Answers

Listview index item update

David Smith

David Smith

8y
265
1

I am trying update a certain row in the listview. I am lost to how to update row by its key. At the moment when I update, the first row is upating only. Can someone assist me? Review logic below.

The index logic below keeps giving me -1 for some reason, when I have data in the listview.


int index = lvUavSystem.SelectedItems.ToString().IndexOf(colorSelected);
if (index > -1)
{
listview.Items[0].SubItems[1].Text = redid.ToString("00.00");
listview.Items[0].SubItems[2].Text = blueid.ToString("00.00");
listview.Items[0].SubItems[3].Text = greeenid.ToString("00.00");
listview.Items[0].SubItems[4].Text = purpleid.ToString("00.00");
}

Answers (2)