dotNet: Is there a way to do a Join statement on the UI Thread?
I’m coding a simple thread application: when clicking a start button, the application disable this button, run 5 threads simply making For iterations and updating 5 ProgressBars. A last thread is waiting for the end of the threads, to re-enable my start button.
Problem: The user is seeing the button enabled before the progressbars are at 100%… And the progressbars are still updating!
What’s the problem? Is there a way to make a join statement on the UI Thread?
Here is the code:
EDIT: Thanks for the link Bjørn-Roger Kringsjå. So there’s a work-around: increase and directly dicrease the value skip the animation. For the max value, set it the value to the max, decrease by 1, and increase by 1…
Okay, I did some testing and it turns out that the problem lies with the progress bar animation. At the time your button gets enabled (which is correct) the progress bar is still in “animation mode”. This can be verified by disabling XP visual styles.
The progress bar have a property name MarqueeAnimationSpeed, but unfortunately this have no effect when using
I did a google search and found this SO post: