I have been working with c# for about a year and with Visual Studio for a couple months. I was debugging a web browser that I made and I found out that when I go to a web site other than google, the url on the search bar remains the same. even though I told it to change.

here's the code that tells the search bar to change

private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            textBox1.Text = webBrowser.Url.ToString();
        }

and the full project is below. Any help will be appreciated. Thanks :)

You are making one small mistake.

Select your webBrowser in the designer. In the properties panel switch to "Events" and for "DoucmentComplete" event select the "webBrowser_DocumentComplete".

OR you can do it via code:

webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);

so let me get this straight, Does the code that you posted go into the form designer?

Aha!! :) srry, I get it now, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.