I have created one listview and display items with the using BackgroundWorker thread , But it will thrown an 'Cross thread exception ' in winforms.
Please give me a solution.
thank you.
Home / DeveloperSection / Forums / How to handle 'Cross thread exception' in winforms
Anupam Mishra
19-Jan-2016or
// avoid exception 'Cross thread exception' if we using this
ListViewItem _item = new ListViewItem();
if (listView1.InvokeRequired)
listView1.Invoke(new MethodInvoker(delegate
{
listView1.Items.Add(_item);
}));
else
listView1.Items.Add(_item);