I have following code:
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Action1);
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Action2);
Works just fine.
But they seem to trigger every time any page is done downloading.
Though I want them to trigger only once for every page.
Say Action1 for Page1, Action2 for Page2 etc.
I tried to add an empty handler like this:
void StopDoingStuff(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Application.DoEvents();
}
But it seems that C# triggers this as a third handler for DocumentComplete event, so it does not actually stop other two.
Do you know how to fix it?
To unsubscribe from an event, use the following syntax:
Here’s an msdn explanation: http://msdn.microsoft.com/en-us/library/ms366768(v=VS.100).aspx