Craig Johnston Craig Johnston - 1 month ago 16
C# Question

Use of Application.DoEvents()

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?

Answer

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.

Comments