954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Web Browser control with Tabcontrol

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
ChadW
Light Poster
42 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

>> Typo's are one thing. Completely failing to grasp the concept of proper spelling and grammar, is just plain dumb.

English is not the native language of many posters, so I rarly, if ever, criticize anyone for their use of English unless they use abbreviations such as y for you.

Sorry about not answering your question -- I don't know. :confused:

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

My signature was aimed more towards those folks that use "Lazy Speak" or "L33T speak", words like: u or ur, hai, etc. However, I do see how the way my sig is phrased could be construed differently.

That aside.. anyone have any ideas pertaining to my question?

ChadW
Light Poster
42 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Imagning the tab control is tc

tc.selectedtab


will do it

r.anshul
Newbie Poster
12 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You