S
Steve Terepin
My application needs to have three Forms, each of which runs on its own thread ie with its own independent message loop etc. I've implemented this by creating three Thread instances, where the ThreadStart delegate points to a method that does something like this :
void MyThreadStart ( )
{
System.Windows.Forms.Application.Run(
new MyForm() // Different MyForm class for each thread
) ;
}
This works fine most of the time, but just occasionally (perhaps one time in ten) an exception gets thrown in the InitializeComponent method called by my Form's constructor. The error message tells me that a ThreadStateException has occurred. So maybe 'Application.Run' isn't the right way to do this. Any ideas, anyone ?
Thanks,
Steve.
void MyThreadStart ( )
{
System.Windows.Forms.Application.Run(
new MyForm() // Different MyForm class for each thread
) ;
}
This works fine most of the time, but just occasionally (perhaps one time in ten) an exception gets thrown in the InitializeComponent method called by my Form's constructor. The error message tells me that a ThreadStateException has occurred. So maybe 'Application.Run' isn't the right way to do this. Any ideas, anyone ?
Thanks,
Steve.