Click here to Skip to main content
15,920,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends.

I write a program that does a time consuming work. the results of this work is shown in a RichTextBox. The program does not act while the work is processed.

I want to show the results in RichTextBox and the program be responsible for mouse click, minimizing,..

how can i do this?

Thanks.
Posted
Updated 8-Apr-15 2:26am
v2

1 solution

Simple: Move the "huge task" to a BackgroundWorker, and use the progress report to update the RichTextBox.
That way, the UI thread is free to do anything it needs to, including respond to the user mouse clicks!

https://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker(v=vs.110).aspx[^] - the link includes an example.
 
Share this answer
 
Comments
r.kh 9-Apr-15 3:49am    
If programmer call the ReportProgress(Int32) function very much, for example: 1000 per 1 second, the Windows Form dont responed.
OriginalGriff 9-Apr-15 4:11am    
Then don't call it so often! :laugh:
Buffer up display updates and issue them all together.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900