This concerns a windows application in which I want to do a short computation, display a message based on the result, and then go into a longer computation. However, the second computation apparently pushes the message off the queue, so that it does not appear until the second computation is finished. If I don't start the second computation until I click a button, everything works fine, but that's not the way I want to do it. Can I somehow tell the second computation to hold its horses for a while

Requesting a computation to wait
Cherming
You can try calling Application.DoEvents(), although if it's all in one spot, in a single thread, I don't see why you'd have to.
Dameon51
Ah... I thought you had a messagebox, but it's a label, so DoEvents is what you needed. That call forces the app to let paint events etc run before it continues.
The lightbulb was caused by the stupid emoticons. Oh, how I hate them.
Rajesh Nallani
Your reply solved the problem, and I am very grateful. And since you expressed some doubts as to the necessity of doing it, I am enclosing the section of code concerned.
private void ReadyToCompute(){
oF = iF +
"-out.raw";label3.Text = oF;
oL = fL + iL;
label6.Text =
"Will contain "+ oL.ToString() +
" binary entries";progressBar1.ForeColor =
Color.Red;progressBar1.BackColor =
Color.White;progressBar1.Value = 0;
progressBar1.Visible =
true; Application.DoEvents();Compute_();
return;}
private void Compute_(){
FileStream oFS = new FileStream(oF, FileMode.Create); if (Text3.Checked);
else{
oBW =
new BinaryWriter(oFS); double[] oValues = new double[oL];MaxOut = 0.0;
progressBar1.Maximum = oL;
for (i = 0; i < oL; i++){
oValues
= 0;
for (j = 0; j < Math.Min(fL, i); j++) if (i - j < iL)oValues
+= fValues[j] * iValues[i - j];
if (i % 1000 == 0) progressBar1.Value = i;}
for (i = 0; i < oL; i++){
V = oValues
;
if (V < 0) V = -V; if (V > MaxOut) MaxOut = V;}
factor = 32000.0 / MaxOut;
for (i = 0; i < oL; i++){
oValues
*= factor;
oBW.Write(
Convert.ToInt16(oValues}
}
return;}
The statement in question is at the end of the first section of code, followed by the call to Compute_(). If I comment out "Application.DoEvents" the whole computation in "Compute_()" is done before the messages in "ReadyToCompute()" appear.
Neils