|
-
April 2nd, 2007, 04:49 PM
#1
[RESOLVED] How to update a ToolStripProgressBar from a thread
I have a Windows form that has a StatusStrip that contains a ProgressBar. I want to update the ProgressBar from a thread started by the form when a treeview item is clicked on. I set up a delegate and a method to issue the PerformStep() but the compiler tells me that the ToolStripProgressBar does not contain a definition for Invoke.
How do I update the progress bar?
Thanks in advance,
Hal
Last edited by HalD; April 2nd, 2007 at 10:28 PM.
Reason: Change title
up·grade (up'gräd'),
to take out old bugs
and put in new ones.
-
April 4th, 2007, 04:22 AM
#2
Re: How to update a ToolStripProgressBar from a thread
Use a BackgroundWorker, and update the progressbar from the worker's progresschanged event, which is UI thread safe
If youre on 1.1 .net and dont have a BGW, you can get one by googling; its not part of the framework.
If youre on 1.0, upgrade
If you dont want to upgrade, you can call InvokeRequired on the form itself, and if it is needed, Invoke a method tha tupdates the progressbar. Pointless though, when background worker makes it so nice, and painless
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
|