While True
Application.DoEvents()
System.Threading.Thread.Sleep(500)
End While
If I run this I observe the expected behavior of my form processing user events every 500 ms. I understand from the documentation that the message queue is being processed with every call to DoEvents().
What I am not understanding is where this processing fits in the threading model of .NET. Is the event processing as a result of the call to DoEvents() necessarily happening on the UI thread? What about if DoEvents() is called from another thread besides the UI thread?