Quote Originally Posted by Shaggy Hiker View Post
It fires. If DoEvents solves the problem, then the problem was that you are blocking somewhere and preventing the application from pumping messages. If you don't give the application the opportunity, it never gets to process the events, and they just stack up in the queue. DoEvents pauses whatever else you are doing so that the application can process the queue. Therefore, I think you ought to step through the code without DoEvents and see what is happening. Most likely you are spinning perpetually on something. For instance, if you just commented out the DoEvents in the code you showed, you'd spin forever on that loop.

As it is, the loop is a busy wait which is about the worst thing you can do. Unfortunately, I naively thought that DocumentCompleted meant that the Document really was Completed, but with the complexity of modern web pages, it isn't quite. Still, if you have to spin wait, do so in the DocumentCompleted event so that the program can get that far without clobbering the CPU.

form4 does not fire form1 events unless i do system.application.doevents()

form4 code:

debug.print form1.webbrowser1.url.tostring()
'shows www.google.com

form1.webbrowser1.navigate("www.yahoo.com")

debug.print form1.webbrowser1.url.tostring()
'shows www.google.com after i've told form1 to navigate.

system.threading.thread.sleep(100000)

debug.print form1.webbrowser1.url.tostring()
'shows www.google.com after i've told form1 to navigate and slept the thread for 100 seconds.