Andre Pena
Andre Pena

Reputation: 59416

Question about modal forms and threads

In the main thread I need to do the following:

  1. Create a second thread where I'll show a modal form that will act as an "activity indicator"
  2. Start a task (this task MUST be executed from the main thread)
  3. Close the modal form created in the second thread.

The question is that I don't know how to show a modal form and not stop the main thread.

Any suggestion?

Upvotes: 3

Views: 584

Answers (1)

noctonura
noctonura

Reputation: 13129

I would use a ThreadPool thead... something like...

ThreadPool.QueueUserWorkItem(o => dlg.Show());

This will launch the dialog on a separate thread. Your main thread will continue processing.

Upvotes: 2

Related Questions