none
navigating to a URL

    Question

  • I was making a web browser in visual basic, and i have buttons that make my browser navigate to places such as home (like the whole .GOhome thing) but i made another button, and i wanted it to be that when i run the application and i click the button, my browser would navigate to a URL of my choice (like myspace or something for example). but i cant figure out how to do so, can some one please help?

    Monday, September 22, 2008 11:11 PM

Answers

  • Looks like you've figured out most of this, since you have already made a button to go to the home page.

    All you need to do is put a text box on the form for the user to type the URL.  Then, in the button, call the Navigate method:

        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click  
            WebBrowser1.Navigate(TextBox1.Text)  
        End Sub 

    • Marked as answer by revaew Tuesday, September 23, 2008 12:06 AM
    Monday, September 22, 2008 11:23 PM
  •  
    Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click     
        WebBrowser1.Navigate("www.myspace.com")     
    End Sub    
     
    • Marked as answer by revaew Tuesday, September 23, 2008 12:06 AM
    Monday, September 22, 2008 11:35 PM

All replies

  • Looks like you've figured out most of this, since you have already made a button to go to the home page.

    All you need to do is put a text box on the form for the user to type the URL.  Then, in the button, call the Navigate method:

        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click  
            WebBrowser1.Navigate(TextBox1.Text)  
        End Sub 

    • Marked as answer by revaew Tuesday, September 23, 2008 12:06 AM
    Monday, September 22, 2008 11:23 PM
  • Thanks, that helps a bunch and if you wouldn't mind, i have one more question.


    how would i get a button to go somewhere. like if i have a button that says something on it ( i will use myspace again). if i have a button that says myspace as the text on the button. how can i make it so that when i click the "myspace button"  i would navigate to myspace.com? thanks again
    Monday, September 22, 2008 11:29 PM
  •  
    Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click     
        WebBrowser1.Navigate("www.myspace.com")     
    End Sub    
     
    • Marked as answer by revaew Tuesday, September 23, 2008 12:06 AM
    Monday, September 22, 2008 11:35 PM
  • i thought i had tried that lol, but thanks a ton, that makes life a lot easier lol thanks again!!!
    Monday, September 22, 2008 11:52 PM
  • i thought i had tried that lol, but thanks a ton, that makes life a lot easier lol thanks again!!!
    Monday, September 22, 2008 11:52 PM