I am currently making a tabbed browser. I can open as many tabs as I want and close how many I want. But when I have closed all of them, and I am at my first tab, when I try to open a new one from my first tab the browser crashes and gives me this error:
This is my code for adding a new tab:
And this is the code for the index: Dim int As Integer = 0
Please help me!
VB.NET:
InvalidArgument=Value of '#number of tabs that were open' is not valid for 'index'.
VB.NET:
Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
TabControl1.SelectTab(int)
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("xxxxx")
End Sub
And this is the code for the index: Dim int As Integer = 0
Please help me!