Richard Payne
asked on
C#, VS2008, Thread, Progress-Bar within form.
(a) I have ordinary window form called AccessForm with button and a ProgressBar
(b) When the button is clicked, it will performs an operation involving internet and files, which is slow process,
(c) I found that while the an operation is ongoing, the AccessForm is hanged waiting for completion of the operation.
(d) This affects the ProgressBar because it does not show progress even when I made a value change.
(c) Thus I'm using WorkerThread that encapsulate the slow operation in order to keep AccessForm active and available for user, so user can stop the operation when needed.
Question
(a) What the best way to update the ProgressBar within the AccessForm when threaded routine can completed one stage of several tasks.
(b) I prefer not to send code, however is there similar example?
Thanks.
(b) When the button is clicked, it will performs an operation involving internet and files, which is slow process,
(c) I found that while the an operation is ongoing, the AccessForm is hanged waiting for completion of the operation.
(d) This affects the ProgressBar because it does not show progress even when I made a value change.
(c) Thus I'm using WorkerThread that encapsulate the slow operation in order to keep AccessForm active and available for user, so user can stop the operation when needed.
Question
(a) What the best way to update the ProgressBar within the AccessForm when threaded routine can completed one stage of several tasks.
(b) I prefer not to send code, however is there similar example?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the best practice is using BackgroundWorker on your form. You can find the example in this page:
http://www.codeproject.com/KB/threads/genericbackgroundworker.aspx
Progress Bar Best Practices
http://www.codeproject.com/KB/progress/ProperProgress.aspx