Hey

So i got a Webbrowse (wb_MainBrowser) and a button.


for the webbrowser i got a code that looks like this:

private void wb_MainBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (wb_MainBrowser.Url.ToString() == "http://www.google.dk/")
            {
                MessageBox.Show("HEY");
            }
        }

and i got a button that goes

private void btn_Start_Click(object sender, EventArgs e)
        {
            if (!wb_MainBrowser.IsBusy)
            {
                wb_MainBrowser.Navigate("http://google.com/");
            }
            else
            {
                MessageBox.Show("Please let the page finish loading!");
            }
        }

for some reason it shows me the hey message, I've tried creating a new project, but im ending up with the same, for no apparent reason, and I'm getting rather irritated :(.

Is there anyway i can make it only execute it once?

Regards
-Jaz

can you be little bit clear in your question

What are you actually asking? is it that you want to execute this once? or you don't want the hey message?

i just want it to be executed once :)

the hey message was just a test to see how many times the event was triggered :)

ok make an integer variable let's say count and update it in calling function and put condition on its value like

int count=0;
public void caller()
{
if(count==0)
{
function1();
count++;
}
else
{
MessageBox.Show("Over done");
}
}
public void function1()
{
}
commented: Thanks for your help, it's very much appreciated :) +2

Thanks ill give a try, and report back :D

Worked like a charm, thank you so much! :D