I am using a backgroundworker that are doing Very much work. I have about 300 pages of code inside this worker, where it is happening a lot of different things.
Everything happens inside a for loop like my code here.
The problem is this that if I just as much as do a mouseclick on the blue upperpart of the Form besides the minimize button the Form gets completely stuck.
But, If I use a messageBox like this every loop, the Form Does Not get stuck.
Without see all this code, what can this depend on. I have tried to use Application:: DoEvents() instead but that did not help.
I would be very happy for an idéa of how to solve this just with the fact that the MessageBox does solve the problem ?
Perheps there is any kind of simular call that could be called.
private: System::Void backgroundWorker3_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
label187->Text = "0";
for( int i = 0; i < 100; i++ )
{
Thread::Sleep(10000);
//A lot of code here
MessageBox::Show("This message will not cause the form to freeze & get stuck ?");
//Application::DoEvents();
}
}