Function/Form Seperate Thread

  • Thread starter Thread starter Sarah
  • Start date Start date
S

Sarah

From a Windows form, how do I get a new different form to run in a separate
thread? What about a function in a separate thread?

Thanks.
 
Sarah said:
From a Windows form, how do I get a new different form to run in a
separate
thread? What about a function in a separate thread?

Avoid showing forms in separate threads. Instead, create and show all forms
in the application's main UI thread and perform blocking operations in
separate threads. Instance members of Windows Forms controls are not safe
for multithreading, so you cannot access them directly from the worker
threads. You will have to use 'Control.Invoke'/'Control.BeginInvoke' to
access the forms/controls from your threads.

Multithreading in Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top