|
-
Apr 22nd, 2008, 09:03 AM
#1
Thread Starter
Member
[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.
-
Apr 22nd, 2008, 09:10 AM
#2
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)
-
Apr 22nd, 2008, 09:20 AM
#3
Thread Starter
Member
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?
-
Apr 22nd, 2008, 09:39 AM
#4
Re: [2005] URL changed via Textbox
 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?
Text Boxes can't read.
-
Apr 22nd, 2008, 09:41 AM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|