How to wait till webbrowser completes sending a form?

  • Thread starter Thread starter mebeserk
  • Start date Start date
M

mebeserk

I've got a program that has to submit forms automaticly and go to the
next page.

I know that the following code works for Navigate but it hasn't any
affect on Documents.Forms[0].InvikeMember("Submit");.

=== My code ===
Browser.Navigate("http://www.google.com/");
while (Browser.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
=== My code ===

Does any know the sollution, I preffer to don't use a variable that's
been set on the event DocumentCompleted.
 
I'm assuming it leaves immediately? (rather than not at all)
Well, one way would be to set a flag in the DocumentCompleted event -
possibly a (volatile) bool or a ManualResetEvent or something similar; just
include a check on this in the loop. I haven't tried hooking up the code
(because it takes a bit of faffing to get forms working in this way; picking
a server etc), but you could also try simply checking the IsBusy property?

Marc
 
THnx for you reply.
I tried somethings already by now =P, but I used Navagated event of
WebBrowser,
this way you can check if the form has been sent. And after that you
can still choose if you want to wait till the document is loaded or
interactive or whatever you want.
 
Back
Top