Question Help With Tabbed Browser

WiiFan2012

Member
Joined
Jan 15, 2010
Messages
17
Programming Experience
Beginner
I know how to add a tab, but I don't know how to subtract a tab.

Here is my code for adding:

VB.NET:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim t As New TabPage
        Dim w As New WebBrowser
        t.Text = "New Tab" & TabControl2.TabPages.Count + 1
        w.Dock = DockStyle.Fill
        w.Navigate("http://google.com")
        t.Controls.Add(w)
        Me.TabControl2.Controls.Add(t)
End Sub

Note: I was using two tab controls, so TabControl2 is not a mistake. (FYI)

Thanks for the help.
 
Depends on how you are removing it. If you are using the right mouse button use the MouseDown event and loop thru the tabpages to find if TabRect(index).Contains(mousePosition) then remove that index. Otherwise:
VB.NET:
tabcontrol2.Tabpages.RemoveAt(tabcontrol2.SelectedTab)
 
Back
Top