DoEvents in c#.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, guys,

As you know, in VB6, we have have DoEvents.

How can we do the same job in c#.net? Thanks.
 
Hello,

short answer: Don't use it.

Long answer:
You can call Application.DoEvents() to get a similar functionality. But if
you perform long-running tasks, perform them on a background thread and just
use the UI thread to update the UI.

In .NET, you can utilize the BackgroundWorker for that. It nicely handles
all the cross-thread calls which are necessary to update the UI.

In .NET 1.1, use the ThreadPool or a dedicated new thread and update the UI
with calls through form.Invoke(), where form is the window you want to
update.

Best regards,
Henning Krause
 
Back
Top