WebBrowserComplete only firing once.

  • Thread starter Thread starter Derek Leuridan
  • Start date Start date
D

Derek Leuridan

I have the default webbrowser listener:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//Stuff

}

and a button that calls:

webBrowser1.Navigate(URL)
URL="differentpage";

-----------------------------------------------------

I click the button, page loads, event fires. This only works once. After I click the button again, differentpage loads, but the event doesn't fire anymore.

Any ideas?



EggHeadCafe - Software Developer Portal of Choice
C# : row-clickable GridView and get and set gridview rows using JavaScript
http://www.eggheadcafe.com/tutorial...9465-c45307bae45b/c--rowclickable-gridvi.aspx
 
Derek said:
I have the default webbrowser listener:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//Stuff

}

and a button that calls:

webBrowser1.Navigate(URL)
URL="differentpage";

-----------------------------------------------------

I click the button, page loads, event fires. This only works once. After I click the button again, differentpage loads, but the event doesn't fire anymore.

Any ideas?



EggHeadCafe - Software Developer Portal of Choice
C# : row-clickable GridView and get and set gridview rows using JavaScript
http://www.eggheadcafe.com/tutorial...9465-c45307bae45b/c--rowclickable-gridvi.aspx

Somehow you must be unsubscribing from the event.

By the way, set your URL to "http://www.cnn.com", and you should get
many more than one event per Navigate. Many pages load other pages in
IFrames (I believe) causing multiple DocumentCompleted events to be
raised from one base url.
 
Family said:
Somehow you must be unsubscribing from the event.

Or, alternatively, the original WebBrowser object is somehow replaced by
a new one, without the event subscription that was in the original.

As always, since the OP hasn't provided a concise-but-complete code
example that reliably demonstrates the problem, it will be difficult or
impossible to say for sure what's wrong.

To the OP: post a concise-but-complete code example that reliably
demonstrates the problem. With that, there are a number of people who
will read your post who will be able to determine for sure why the event
isn't working as expected. Without it, the chances of that are almost zero.

Pete
 
Back
Top