Hey Just a probably very easy question but I'm making a small web browser to put in a program. Basically its a tab control and a button atm, when the buttons pressed it uses the code below to add a new tab and make the tab a web browser.
Code:
      
        Dim browse As New WebBrowser
        TabControl1.TabPages.Add(i, "page" & i)
        TabControl1.SelectTab(i - 1)
        browse.Name = "WB"
        browse.Dock = DockStyle.Fill
        TabControl1.SelectedTab.Controls.Add(browse)
        i = i + 1
What I want is when I navigate to a web page for the tab name to be the title of the web page (instead of tabpage1, tabpage2 etc). I was told to put the below code in the web browser navigated sub but seeing as that sub isn't available because there isn't a browser in there until its running I have no where to put the code. What can i do? Sorry if this is about confusing, found it a bit hard to describe Thanks.

Code:
me.tabcontrol1.selectedtab.text=ctype(me.tabcontrol1.selectedtab.controls(0), webbrowser).documenttitle 

me.text=ctype(me.tabcontrol1.selectedtab.controls(0), webbrowser).documenttitle & " - ur program name here"