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

Posted on 2010-01-02
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.

(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?


Question by:Richard Payne
    LVL 3

    Expert Comment

    the best practice is using BackgroundWorker on your form. You can find the example in this page:

    hope it works ;)
    LVL 3

    Accepted Solution

    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:

    hope this helps


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    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…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now