adding tabs

Updated choover12 0 Tallied Votes 305 Views Share

you can do this

dim i as integer = 0
Public Sub Addtab()
        Dim browser As New webbrowser
        browser.Dock = DockStyle.Fill
        'docking it
        browser.ContextMenuStrip = main.cms
        'adding a context menustip to it
        Dim tab As New TabPage
        tab.Controls.Add(browser)
        main.Tabs.TabPages.Add(tab)
        'IMPORTANT you must select the tab
        main.Tabs.Select(i)
        i += 1

    End Sub

well you don't just have to add browsers, you can do this

dim i as integer = 0
public sub addtab()
dim yourvariable as system.windows.forms.object 'name your variable and tell it your object
yourvariable.dock = dockstyle.fill 'everything has a dock
yourvariable.name = "yourname" 'everything has a name
'this way seems the easiest for me
dim tab as tabpage
tab.controls.add(object)
tabcontrol1.tabpages.add(tab)
tabcontrol1.selecttab(i)
i += 1
end sub
here is how to add tabs