I'm writing a program to navigate a website, but I'm having trouble with code execution occuring when I don't want it to execute.
I have a WebBrowser control where once the page finishes loading, I have code analyzing the html, and for certain circumstances I tell the WebBrowser to navigate to a new URL.
So I basically have a line of code that looks like this, within a method, the method within the DocumentCompleted handler
if this condition then
wb.Navigate(new Uri("http://www.website.com"), "_self");
else do something else, exit method, continue processing code
However, when I Navigate, the code continunes to execute beyond the Navigate. It exits the method, and keeps processing code.
How to I stop the DocuemntComplete event handler from processing whenever I call a new page navigation?