updating RTB from backroundworker (not the usual)

sgr0v3s

New member
Joined
Jul 24, 2013
Messages
2
Programming Experience
5-10
I have a form with a RTB control and a backround worker, from the backround worker i create a new instance of my class that does some continuous work until the user cancles or exits the application, what I wan to know is how from that class I can update my RTB?

So:
Mean thread -> backround worker -> call to class (do some work, updating rtb)

hope that made sense:disturbed:
 
The whole point of the BackgroundWorker is that the DoWork event is raised on a secondary thread while the ProgressChanged and RunWorkerCompleted events are raised on the UI thread. If you want to update the UI after the work has completed then handle RunWorkerCompleted. If you want to update the UI during the work then call ReportProgress and handle ProgressChanged. Here's one I prepared earlier:

Using the BackgroundWorker Component

That doesn't update an RTB but the actual control and the actual data are irrelevant because the principle is exactly the same regardless.
 
The whole point of the BackgroundWorker is that the DoWork event is raised on a secondary thread while the ProgressChanged and RunWorkerCompleted events are raised on the UI thread. If you want to update the UI after the work has completed then handle RunWorkerCompleted. If you want to update the UI during the work then call ReportProgress and handle ProgressChanged. Here's one I prepared earlier:

Using the BackgroundWorker Component

That doesn't update an RTB but the actual control and the actual data are irrelevant because the principle is exactly the same regardless.


Hi, thanks for that although it didn't solve my issue, sometimes the only way is to do it yourself so I managed shortly after writing the first post, it's messy but works :D well.. now that qualifies me as the average Microsoft programmer! ;) a dirty fix.
 
If you did it as demonstrated then it would have worked. If it didn't work then you did it wrong. If you were to show us what you did and tell us what happened then we would likely be able to help you fix it.
 
Back
Top