I've created a web browser (similar to the beginners project) with the following items:
- 1 Text Box (for url entry, with "enter" support)
- 4 Nav buttons (Forward, Back, Go, Home)
- 1 Tabcontrol holding 2 tabbed pages
Question: How do I get TabPage2 to navigate to the entered URL? Currently, only TabPage1 responds when a URL is entered into the textbox. I've tried IF/THEN statements, but it's not working. (Though, to be fair, I'm still a newb. hehe) Currently, you'll see that I have a statement
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
And yes, I understand that it is doing exactly what it's supposed to, I just can't figure out how to tell program that when the tabpage2 is active, to navigate that page (and not tabpage1)
Public Class Form1
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Navigate("http://google.com")
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
WebBrowser1.Navigate(TextBox1.Text)
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
TextBox1.Text = WebBrowser1.Url.ToString
End Sub
End Class