Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 308
André Pena Avatar asked Dec 29 '25 15:12

André Pena


1 Answers

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.

like image 104
noctonura Avatar answered Jan 01 '26 03:01

noctonura



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!