C# Multi threading- Move objects between threads

Posted by Grant on Stack Overflow See other posts from Stack Overflow or by Grant
Published on 2010-06-01T23:36:02Z Indexed on 2010/06/01 23:43 UTC
Read the original article Hit count: 167

Filed under:
|
|

Hi, i am working with a winforms control that is both a GUI element and also does some internal processing that has not been exposed to the developer. When this component is instantiated it may take between 5 and 15 seconds to become ready so what i want to do is put it on another thread and when its done bring it back to the gui thread and place it on my form. The problem is that this will (and has) cause a cross thread exception.

Normally when i work with worker threads its just with simple data objects i can push back when processing is complete and then use with controls already on the main thread but ive never needed to move an entire control in this fashion.

Does anyone know if this is possible and if so how? If not how does one deal with a problem like this where there is the potential to lock the main gui?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms