Application.DoEvents question.

Posted on 2007-07-30
Last Modified: 2013-11-26
Hi guys.

I have a  function that execute some stuff in it

And for each stuff I have a text that is send to the statuslabel in my statustrip,
the problem is that it's not updating if I don't run Application.DoEvents efter each text update.

Can I solve this in another way?
Question by:AWestEng
    LVL 22

    Assisted Solution

    No. Application can only do one thing at a time (except if the function executes in another thread) and the form refreshes only when the processing is finished (when the application becomes idle) or you call the DoEvents.

    What's the problem with running the DoEvents function?
    LVL 62

    Accepted Solution

    Hi AWestEng;

    The only other way to solve this is to place the code in another thread so it does not block the user interface from getting updates. Care must be take as you can not update a UI control from another thread directly, you will need to use the controls Invoke method. If you are using VS 2005 The background worker thread will do the job.

    LVL 1

    Author Comment

    oki.. thx guys.. :)
    LVL 62

    Expert Comment

    by:Fernando Soto
    Not a problem, glad I was able to help. ;=)

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    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.

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now