sharkin
sharkin

Reputation: 12498

C#/.NET - How to trigger update of listview from another thread

It seems I'm forbidden to access (i.e. update) my list view control from another thread than the main thread.

How can I perform some threaded task and then signal somehow to start the update of the listview?

Upvotes: 2

Views: 3875

Answers (1)

James Black
James Black

Reputation: 41858

You need to call Invoke() to make the change.

The reason why is explained here: http://blogs.msdn.com/davidklinems/archive/2006/03/09/548235.aspx

How to do it with an example is shown here: http://msdn.microsoft.com/en-us/library/ms171728%28VS.80%29.aspx

Basically the changes have to be done from the main thread, so you have to get back on that to do your update.

Upvotes: 5

Related Questions