VB. Net app- UI threads/ background process help

Posted on 2011-05-07
Last Modified: 2012-05-11

I was wondering if someone can help. I am creating an application and require a database extract to be done for the user as well as a status bar to move to inform the user of the progress made. The problem is that the screen locks up when this is started and the user is unable to do anything else. I have had a look at possibly using threads as well as something called background process which seems like this could work. The only problem is if i create a thread etc i need to pass a count between this and the user interface. Can someone recommend the best way to keep these in sync.


Question by:ross13
    LVL 24

    Expert Comment

    by:Jeff Certain
    You can use BackgroundWorker and report progress. Here's the MSDN sample.
    LVL 85

    Accepted Solution

    If you use the BackgroundWorker() control:

    ...then you simply call the ReportProgress() method from the DoWork() handler:

    This will cause the ProgessChanged() event to fire.  It is safe to update the GUI from that event:

    *The WorkerReportsProgess() property must be set to true:
    LVL 24

    Expert Comment

    by:Jeff Certain
    Wow... that's a much more description answer than mine. Well done Bob!
    LVL 69

    Assisted Solution

    by:Éric Moreau
    instead of using threading for database access, you should use the asynchronous features built-in to ADO.Net:
    LVL 12

    Expert Comment

    by:Mohamed Abowarda

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    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…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now