I am working on a multi-threaded application in C#/.net
I want each thread to create its own form so it can access it and show its information on its form without any problem
is there any way to do that?
I’ve tried Application.Run(new MyForm()) but the problem is that this function blocks the execution and my thread can’t do its work.
I am working on a multi-threaded application in C#/.net I want each thread to
Share
This is by design. The thread can only do one thing at a time, so if your code runs the UI on that thread will be blocked, and if you want to run a UI you’ll have to use some messaging construct (such as a timer) to get your work done.
The proper way is indeed to have one UI thread and have other threads asynchronously post progress messages for being displayed on the UI (using
BeginInvokeon the form for instance, which is safe to be called from other threads).