I have a RichTextBox control in a C# application. I am going through a loop
that spawns processes and outputs data to the richtextbox before and after
each spawn occurs. The odd thing is is that the rich text box is not being
updated till after the looping of spawned processes occurs.
I've got code a routine that does the following:
public void OutputString(string str)
{
richTextBox.AppendText(str);
}
I would expect this to simply update my richTextBox control each time it is
invoked, but the update of the control doesn't occur till the very end of
looping of spawned controls.
I've even added the line richTextBox.Refresh() immediately after the
AppendText line but to no avail. Any suggestions on how to force the
RichTextBox control to update itself?
Have you tried making a call to Application.DoEvents()? There are other
options in this situation too.

Signature
Tim Wilson
.Net Compact Framework MVP
> I have a RichTextBox control in a C# application. I am going through a loop
> that spawns processes and outputs data to the richtextbox before and after
[quoted text clipped - 14 lines]
> AppendText line but to no avail. Any suggestions on how to force the
> RichTextBox control to update itself?
Steve Teeples - 30 Mar 2005 19:35 GMT
That did the trick. I didn't know such a method existed. I'll need to read
up on the Application class. Thanks for the education - and the solution!
> Have you tried making a call to Application.DoEvents()? There are other
> options in this situation too.
[quoted text clipped - 20 lines]
> > AppendText line but to no avail. Any suggestions on how to force the
> > RichTextBox control to update itself?