There is never a reason to call this method, and every reason not to. It should be marked "deprecated" and eventually removed from the framework. See comments of others. The sample is a terrible example of coding practices. If the DoEvents() method processes WM_QUIT, your application will quit in the middle of your processing. There are many suitable alternatives, depending on the situation.
Use Control.Update(), use background worker, call methods asynchronously through a delegae, queue up a task on the thread pool; even creating a thread and running the work on the threadproc is better than making this call.