• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Application.DoEvents question.

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?
  • 2
2 Solutions
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?
Fernando SotoRetiredCommented:
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.

AWestEngAuthor Commented:
oki.. thx guys.. :)
Fernando SotoRetiredCommented:
Not a problem, glad I was able to help. ;=)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now