Updating vb window from a c program
Or to put it another way, there is no way for the user to make your program run code in a different order.
It will execute predictably, just like it did when you tested your code.
It can be useful for updating progress bars and notifying the user of progress in something like Main Form construction and loading, if that takes a while.
The user could for example close the main window while the loop that calls Do Events() is running. But your code didn't stop, it is still executing the loop. Now you have two nested loops executing Do Events(), the previous loop is suspended and the new loop is starting from scratch. Especially when the nested loop ends and the suspended one resumes, trying to finish a job that was already completed. There's been an enormous amount of backlash against it, but nobody ever really explains why it is "bad".The same kind of wisdom as "don't mutate a struct".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 Do Events, then you need to test it thoroughly before deploying your application.