I want change the content of 2nd column of each line of ListView with diferents data according with is found via FindItemWith.
My trouble is that from of 2nd line is be overriding the previous columns, for example when i want change the content searching a text that stays on first line works fine, see:
Already when i want change the content searching a text that stays on second line this happens:
This is the code:
public void fillData(string search, string data, ListView haystack)
{
if (haystack.Items.Count > 0)
{
int idx = 0;
ListViewItem found;
while (idx < haystack.Items.Count)
{
found = haystack.FindItemWithText(search, true, idx);
if (found != null)
{
haystack.Items[idx].SubItems[1].Text = data.ToString();
}
idx++;
}
}
}
private void button3_Click(object sender, EventArgs e)
{
int i = 0;
while (i < 3)
{
ListViewItem item = new ListViewItem();
item.Text = i.ToString();
item.SubItems.Add("192.168.0." + i.ToString());
listView1.Items.Add(item);
i++;
}
}
private void button1_Click(object sender, EventArgs e)
{
fillData("192.168.0.0", "AAA", listView1);
}
private void button2_Click(object sender, EventArgs e)
{
fillData("192.168.0.1", "BBB", listView1);
}

