HELP! Webbrowser Url to a textbox?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
noobcake
Member
Member
Posts: 34
Joined: Sun Mar 27, 2011 12:16 am

HELP! Webbrowser Url to a textbox?
noobcake
I am making a youtube view and sub checker (viewtopic.php?f=70&t=5617)
but the thing is If you where to navigate in the app then when you click the check button, It checks TextBox1.Text to see if it is a valid link, And not the url, so it will error: Incorrect Link. Anyone have any ideas?
i have tried stuff like Textbox1.Text = Webbrowser1.Url As String, but no luck
Any help is appreciated, Feel free to test out my app :)
Thanks
~Noobcake
If i Help you +Rep cooll;

Im new to visual basic so I probly wont :P
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

If you are Using a WebBrowser then on DocumentCompleted Event Add Code
TextBox1.Text=WebBrowser1.Document.Url.ToString

And to Check if its Valid URL use this
If TextBox1.Text.StartsWith("http://www.youtube.com/") then
WebBrowser1.Navigate(TextBox1.Text)
End If

Hope it Helps ;)
YouTube Downloader v3.0
Image
Image
Image
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Eh? try this:
Code: Select all
WebBrowser1_DocumentCompleted...
        TextBox1.Text = WebBrowser1.Url.ToString()
If thats not it try this:
Code: Select all
btnGo_Click...
        If Not TextBox1.Text.Contains("http://www.youtube.com/watch?v=") Then
            MsgBox("Not valid url!")
        Else
            WebBrowser1.Navigate(TextBox1.Text)
        End If
Top-notch casual Dating
User avatar
noobcake
Member
Member
Posts: 34
Joined: Sun Mar 27, 2011 12:16 am

Napster1488 wrote:
If you are Using a WebBrowser then on DocumentCompleted Event Add Code
TextBox1.Text=WebBrowser1.Document.Url.ToString
That worked great, i just had it in the wrong place i guess? Thanks +Rep :)
Napster1488 wrote:
And to Check if its Valid URL use this
If TextBox1.Text.StartsWith("http://www.youtube.com/") then
WebBrowser1.Navigate(TextBox1.Text)
End If
Hope it Helps ;)
Yeah, I have added something like that exept it looks for the /user/ or /watch :)
If i Help you +Rep cooll;

Im new to visual basic so I probly wont :P
User avatar
noobcake
Member
Member
Posts: 34
Joined: Sun Mar 27, 2011 12:16 am

~~~~~~~~~~~~~~~~~~~~ LOCKED ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have found the info I need, thanks guys :) feel free to go to : viewtopic.php?f=70&t=5617 and check out what I have made :)
If i Help you +Rep cooll;

Im new to visual basic so I probly wont :P
5 posts Page 1 of 1
Return to “Coding Help & Support”