?
Solved

C#, VS2008, Thread, Progress-Bar within form.

Posted on 2010-01-02
2
Medium Priority
?
768 Views
Last Modified: 2012-05-08
(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.

0
Comment
Question by:Richard Payne
2 Comments
 
LVL 3

Expert Comment

by:namazikhah
ID: 26160962
hi,
the best practice is using BackgroundWorker on your form. You can find the example in this page:

hope it works ;)
0
 
LVL 3

Accepted Solution

by:
roeib earned 2000 total points
ID: 26162702
well my friend,
you have asked an excellent question:
1. when you have multiple operations and you want the form to be kept alive the best way is to open a secondary Thread and use a delegate in order to update the MainForm on the Operation Status.

in my projects the Progress Bar is running also in a secondery Thread, Here is a sample code Posting:

http://www.c-sharpcorner.com/UploadFile/mahesh/WorkingwithProgressBarinCSharp11302005045625AM/WorkingwithProgressBarinCSharp.aspx

hope this helps

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question