WebBrowserComplete only firing once.

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
 
F

Family Tree Mike

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

Peter Duniho

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
 

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