backgroundworker is not set to report progress?

TyB

Well-known member
Joined
May 14, 2009
Messages
102
Programming Experience
3-5
Hello all,

I am using backgroundworker thread in my app. I also have a class in my project and am able to updated the user UI from the form, but most of my time consuming operation happens in the class so I tried to do an update like this Form1.BackgroundWorker1.ReportProgress(4, strname), but I get an error that say that the backgroundworker is not set to report progress.

I have this set in the load event for the app.

Are you not able to call form items like this from a class?

Thanks in advance for advice.

Ty
 
There is a property called WorkerReportsProgress, make sure it is set to true.
 
If you by "Form1..." are referring to the default instance of the Form1 class then this is the problem. Default form instances are thread specific and when you call it from the worker thread you just get a new form instance. You have to pass the correct instance and refer to that (f.ex record the BackgroundWorker instance).
 
Back
Top