Creating a form on non-gui thread

Posted by luntain on Stack Overflow See other posts from Stack Overflow or by luntain
Published on 2009-10-14T17:25:47Z Indexed on 2010/05/10 12:04 UTC
Read the original article Hit count: 197

Filed under:

You can't access gui controls from a thread they were not created on, at least so says the message of an exception that is sometimes raised when you do it.

Recently I was puzzled by seeing that forms created on background threads work just fine. My mental model was that all actions initiated by UI input is handled on the GUI thread. Clicking on a button on such a form should raise the dreaded exception (the form and all its controls were created on a background thread not the gui thread), but it doesn't. Something is wrong with my map.

(*) well to be honest I have seen one problem where opening the standard open file dialog was blocking everything

© Stack Overflow or respective owner

Related posts about winforms