JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Adding New Tabs at Run Time

You can add new tabs to a Tab control at run time with the Add method of the TabPages collection. You can see an example of this in the TabControls example on the CD-ROM—when the user clicks the "Create Tab 4" button, a new tab appears, as you see in Figure 10.25.


Figure 10.25: Adding a new tab to a tab control at run time.

Here's what it looks like in code:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Dim tabpage As New TabPage()
    tabpage.Text = "Tab 4"
    TabControl1.TabPages.Add(tabpage)
End Sub

Now that you've added a new tab page to a tab control, how do you add controls to that page? See the next topic.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor