Use of Application.DoEvents()

c#, doevents, winforms

Solution

From my experience I would advise great caution with using DoEvents in .NET. I experienced some very strange results when using DoEvents in a TabControl containing DataGridViews. On the other hand, if all you're dealing with is a small form with a progress bar then it might be OK.

The bottom line is: if you are going to use DoEvents, then you need to test it thoroughly before deploying your application.

Problem

Can `Application.DoEvents()` be used in C#? Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's `DoEvents` does?

Original source

Related problems