33 Program for Tab Control And Image List in VB.NET

The Tab control is used to display some specific controls at the same time. When a tab pane is enabled: the controls associated with this tab pane are displayed in the window or in the page. And also when you have less space and you want to display more elements in same form then you can use this tab control property.

Design:



Code:

Public Class Form1

    Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click

        TabControl1.ImageList = ImageList1

        TabPage1.ImageIndex = 0

        TabPage1.BackgroundImage = ImageList1.Images(0)

        TabPage1.Controls.Add(Button1)

    End Sub


End Class






Ouput:




To Add Tab Control at Run Time: 

Design:



Code:

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim dynamicTabControl As New TabControl()

        dynamicTabControl.Name = "DynamicTabControl"

        dynamicTabControl.BackColor = Color.OrangeRed

        dynamicTabControl.ForeColor = Color.Black

        dynamicTabControl.Font = New Font("Georgia", 16)

        dynamicTabControl.Location = New Point(10, 10)

        dynamicTabControl.Width = 400

        dynamicTabControl.Height = 400

        dynamicTabControl.ImageList = ImageList1

        Controls.Add(dynamicTabControl)

    End Sub

End Class








Ouput:


Previous
Next Post »