Q:

How do I unbind a DocumentComplete Handler?

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?

A:

To unsubscribe from an event, use the following syntax:
webBrowser1.DocumentCompleted -= Action2

Here's an msdn explanation: http://msdn.microsoft.com/en-us/library/ms366768(v=VS.100).aspx

