I am making a web browser, and I am trying to add a new tab by clicking a menu strip item;However, I am having trouble with the tabs themselves. The first tab works normally, but when I add a new tab, it adds the tab but it also gets rid of the web browser in the previous tab.I do not plan to use the tab control to browse the web, I want to have a web browser inside of each new tab.
Here is my code for the original tab page.(In case it is important)
And here is my code for the menu strip item.
How could I make it so that when I click the menu strip item it puts a new web browser inside of the new tab it creates?
Here is my code for the original tab page.(In case it is important)
VB.NET:
Function addtab()
Dim myTabPage As New TabPage()
AddHandler theweb.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf Run_Me_On_Load)
myTabPage.Text = "New Tab" & (TabControl1.TabPages.Count + 1)
TabControl1.TabPages.Add(myTabPage)
theweb.DocumentText = My.Resources._New
theweb.Parent = myTabPage
theweb.Visible = True
theweb.Dock = DockStyle.Fill
Return True
Me.SetStyle(ControlStyles.DoubleBuffer, True)
End Function
And here is my code for the menu strip item.
VB.NET:
Dim theweb As New WebBrowser
Dim myTabPage As New TabPage()
TabControl1.TabPages.Add(myTabPage)
myTabPage.Text = "New Tab"
TabControl1.SelectTab(TabControl1.SelectedIndex)
theweb.DocumentText = My.Resources._New
theweb.Parent = myTabPage
theweb.Visible = True
theweb.Dock = DockStyle.Fill
How could I make it so that when I click the menu strip item it puts a new web browser inside of the new tab it creates?