I already know that to update control, I can use Invoke Action
progressBar1.Invoke(new Action(() => { progressBar1.Maximum = 0; }));
But that only work with property of control which are single data. Now I have a thread that need to change the list view collection of list view items, clear it then update with new items, new texts and icon images. What is the different between them, an integer or a bool compare to a list, array or a collection of integer, bool or even component, control. Can I just simple add
string[] newItemText = {"item1", "item2", ...};
listView1.Invoke(new Action() => {
i = 0;
foreach(var item in listView1.Items)
{
item.Text = newItemText[i];
i++;
}
}));
I may need a solution for my list view but if you have an answer, please explain clearly why and how it work, cause I need to learn thoroughly about it. Also you can notice me about the risk when trying that practice.
EDIT: The question is not about how to update control from other thread. IT about when and why need to do this and not to to that. Moreover, I need to know the different between update a single data and update the whole collection of data.