|
-
Jul 14th, 2007, 05:28 PM
#8
Frenzied Member
Re: [RESOLVED] [2005] Setting text property across threads
I couldn't help but notice that you said you had tried to access the ToolStripStatusLabel from within the DoWork event.
That's not allowed since the DoWork event runs on a different thread than the UI thread.
The BackGroundWorker ProgressChanged event runs in a handler that is in the UI thread and can be access from the form.
Just remember to set the WorkerReportsProgress property to True or else you'll get an exception.
So, if you actually did what you said you did and your code accesses anything from the DoWork event (whether or not it appears to be working) you should change the code so that it uses the ProgressChanged event instead.
In fact, it might be good for you to re-run the test you set up and see if it works both ways. If it does, then you'll know that the problem was trying to access from the Worker thread in an improper way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|