[2005] URL changed via Textbox
Hello, I'm having a bit of trouble changing a web browser's URL. I have tried a simple piece of code:
WebBrowser1.Url = TextBox1.Text
Which looks like it should work.
It gives an error saying:
Value of type 'String' can not be converted to 'System.Uri'
Can anyone shed some light on this?
Thanks in advance.
Re: [2005] URL changed via Textbox
either one of these should work fine for navigating the browser to a given URL
Code:
WebBrowser1.Url = New Uri(textbox1.Text)
WebBrowser1.Navigate(textbox1.Text)
Re: [2005] URL changed via Textbox
Yeah they work fine.
Thanks.
Erm ...
How about changing the URL to a string, so like, the Text Box would read the Web Browser's URL constantly?
Re: [2005] URL changed via Textbox
Quote:
Originally Posted by Deadly Asphyxiation
How about changing the URL to a string, so like, the Text Box would read the Web Browser's URL constantly?
:confused:
Text Boxes can't read.
Re: [2005] URL changed via Textbox
You use the Navigated event of the browser (which fires right when navigation has started) and you grab the URL of the browser there.
Code:
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
textbox1.Text = WebBrowser1.Url.ToString
End Sub