Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / March 2005

Tip: Looking for answers? Try searching our database.

RichTextBox refreshing not occurring

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Teeples - 30 Mar 2005 18:37 GMT
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?

Signature

Steve

Tim Wilson - 30 Mar 2005 19:19 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.