Link to home
Start Free TrialLog in
Avatar of bhanley9681
bhanley9681

asked on

UI + Threads

Hi,

I just found out that I wasn't updating my GUI correctly w/ my worker threads (just doing it directly - never had a problem, but I assume race conditions could develop pretty easily).  Anyways, I know I have to use Control.Invoke stuff.

My question is: does the same go for opening a new window?  That is, if I want to open a new Form - think modeless dialog rather than some MDI thing - Do I have to do it from the main thread for it to persist after my thread dies?

In addition: For my own understanding, how is this actually working under the hood?  When you start a new project, don't you have a GUI thread that handles UI events as well as a main worker thread?  Why can you update the GUI w/ the main worker thread and now side threads?  Or is there just one thread?  I'm kinda confused...

When I created a Form from a worker thread, the form only lasted while the worker thread lasted - how does that fit in w/ the above?  The variable w/ a handle to the form wasn't getting disposed or anything.
ASKER CERTIFIED SOLUTION
Avatar of Razzie_
Razzie_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial