Page 1 of 1

HELP! Webbrowser Url to a textbox?

Posted: Sat Apr 16, 2011 12:26 am
by 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

Re: HELP! Webbrowser Url to a textbox?

Posted: Sat Apr 16, 2011 12:29 am
by Napster1488
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 ;)

Re: HELP! Webbrowser Url to a textbox?

Posted: Sat Apr 16, 2011 12:32 am
by Agust1337
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

Re: HELP! Webbrowser Url to a textbox?

Posted: Sat Apr 16, 2011 7:05 am
by noobcake
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 :)

Re: HELP! Webbrowser Url to a textbox?

Posted: Sat Apr 16, 2011 7:08 am
by noobcake
~~~~~~~~~~~~~~~~~~~~ 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 :)