How to wait till webbrowser completes sending a form?

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.
 
M

Marc Gravell

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
 
M

MeBerserk

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top