blah blah blah is here! blah blah » Close

up0down
link

Hi, I'm making a web browser in visual C# and I need to make the address bar change when a new page loads. Here is the code I am using:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
textBox2.Text = webBrowser1.Url;
}

and I get this error: "Cannot implicitly convert 'System.Uri" to 'string'"
Any insight into why this happens would be great.

last answered 2 years ago

2 answers

link

I figured it out, I had to use the convert class to make the uri a string, for those who would like to know how this was done, check this out:

string url1;
url1 = Convert.ToString(webBrowser1.Url);
textBox2.Text = url1;

up0down
link

This is a bit off-topic, but i want to tell you something:

1. The web-browser that you use in Visual C# is Internet Explorer, what you want to do is to change it's user interface.

2. To make a web-browser, is complicated business. What a browser does is grabbing a HTML (PHP,ASP) page from some server, reads it's code and draws the items on a page according to the HTML code. Coding a browser is awful, all you do is to change IE's interface.

You look like you just started to learn C#. I started working at a tutorial a few weeks ago, unfortunately i did not finished it yet. If you are interested you can find it here: http://davidevitelaru.comze.com/resources/Visual%20C%23.pdf
If you are interested in some team-work and learning more about C#, you can always mail me at davide.vitelaru@gmail.com

Feedback