Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WebBrowserComplete only firing once.

1 view
Skip to first unread message

derekleuridan

unread,
Nov 5, 2009, 1:09:58 PM11/5/09
to
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/tutorials/aspnet/7ab7fa12-a697-4b26-9465-c45307bae45b/c--rowclickable-gridvi.aspx

Family Tree Mike

unread,
Nov 5, 2009, 7:53:04 PM11/5/09
to

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.

--
Mike

Peter Duniho

unread,
Nov 5, 2009, 11:33:09 PM11/5/09
to
Family Tree Mike wrote:
> Derek Leuridan wrote:
>> 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?
>>
>
> 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

0 new messages