Better way to update form from multiple threads than InvokeRequired

Posted on 2007-10-10
Last Modified: 2013-12-17
i currently use something like the following to update a label which shows records getting processed:
 public void Update(int Received, int Requested)
            if (this.InvokeRequired)
                this.EndInvoke(this.BeginInvoke(new MethodInvoker(delegate() { UpdateHistTicks(Recieved, Requested); })));
                 lbHist2.Text = "Received " + Received + " out of " + Requested;    


This doesn't seem "smooth" enough. I'm wondering how I might use some sort of queue or other means to update my label? Any suggestions?
Question by:stormist
    LVL 29

    Accepted Solution

    if this method Update is in a separate thread then using the invoke is the safest option..b'coz when u use the invoke method then the code used in the delegate get executed in the thread that created the label...
    LVL 37

    Assisted Solution

    You might want to try the same thing that background worker does which is to use a synchronization context. includes a simple example ....



    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    734 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

    23 Experts available now in Live!

    Get 1:1 Help Now