|
-
Jan 24th, 2013, 01:01 PM
#4
Re: how can I prevent this from causing an error?
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.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|