balexei
December 2nd, 2009, 11:57 AM
Dear Gurus,
I am running some lengthy calculations and attempt to provide some feedback from it in the dialog via showing the iteration number, elapsed time, etc, my "calculation" program looks like this:
void CalcProgram()
{
...
Thread MyProgress = new Thread(new ThreadStart(MyUpdate));
// Start the thread
MyProgress.Start();
for(i=0; i<IterationNumber; i++)
{
...// Long calcuations
...
MessageBox.Show("I am here");
}
}
When I run the program and comment out the MessageBox shown, the thread seem to be not working, i.e. it does not provide the expected output. However, when the message box is there, the thread seem to be working as expected only when the box is shown, when I click "OK" on the box it does not provide any updates until the MessageBox is shown again.
Does anybody knows why????
Thank you.
I am running some lengthy calculations and attempt to provide some feedback from it in the dialog via showing the iteration number, elapsed time, etc, my "calculation" program looks like this:
void CalcProgram()
{
...
Thread MyProgress = new Thread(new ThreadStart(MyUpdate));
// Start the thread
MyProgress.Start();
for(i=0; i<IterationNumber; i++)
{
...// Long calcuations
...
MessageBox.Show("I am here");
}
}
When I run the program and comment out the MessageBox shown, the thread seem to be not working, i.e. it does not provide the expected output. However, when the message box is there, the thread seem to be working as expected only when the box is shown, when I click "OK" on the box it does not provide any updates until the MessageBox is shown again.
Does anybody knows why????
Thank you.