Getting Started with Windows Forms TabControl (TabControlAdv)
10 Oct 20225 minutes to read
Assembly deployment
Refer to the control dependencies section to get the list of assemblies or NuGet package that needs to be added as a reference to use the control in any application.
You can find more details about installing the NuGet packages in a Windows Forms application in the following link:
Create a simple application with TabControlAdv
You can create a Windows Forms application with Windows Forms TabControl (TabControlAdv) using the following steps:
Create a project
Create a new Windows Forms project in Visual Studio to display the TabControlAdv control with tab pages.
Add control through designer
The Windows Forms TabControl (TabControlAdv) control can be added to an application by dragging it from the toolbox to a designer view. The following assembly references are added automatically:
- Syncfusion.Grid.Base.dll
- Syncfusion.Grid.Windows.dll
- Syncfusion.Shared.Base.dll
- Syncfusion.Shared.Windows.dll
- Syncfusion.Tools.Base.dll
- Syncfusion.Tools.Windows.dll
Add tabs
The tabs can be added to TabControlAdv in the following ways:
1. Right-click the TabControlAdv and select the Add Tab option to add the TabPages to TabControlAdv through designer.
2. Add tabs using TabPagesCollection in smart tags of TabControlAdv.
Add controls in tab pages
You can add any control in tab page.
Add control manually in code
To add the control manually in C#, follow the given steps:
-
Add the following required assembly references to the project:
- Syncfusion.Grid.Base.dll
- Syncfusion.Grid.Windows.dll
- Syncfusion.Shared.Base.dll
- Syncfusion.Shared.Windows.dll
- Syncfusion.Tools.Base.dll
- Syncfusion.Tools.Windows.dll
-
Include the Syncfusion.Windows.Forms.Tools namespace.
using Syncfusion.Windows.Forms.Tools;
Imports Syncfusion.Windows.Forms.Tools
-
Create a TabControlAdv instance, and add it to the window.
TabControlAdv tabControlAdv1 = new TabControlAdv(); this.Controls.Add(tabControlAdv1);
Dim tabControlAdv1 As TabControlAdv = New TabControlAdv() Me.Controls.Add(tabControlAdv1)
Add tabs
Create an instance of TabPageAdv, and add it to the TabControlAdv.
TabPageAdv tabPageAdv1 = new TabPageAdv();
this.tabPageAdv1.Text = "tabPageAdv1";
this.tabControlAdv1.Controls.Add(this.tabPageAdv1);
Dim tabPageAdv1 As TabPageAdv = New TabPageAdv()
Me.tabControlAdv1.Controls.Add(Me.tabPageAdv1)
Me.tabPageAdv1.Text = "tabPageAdv1"
Add controls in tab pages
You can add any control in TabPageAdv. Create an instance of the control, and add it to TabPageAdv.
SfCalendar calendar = new SfCalendar();
tabPageAdv1.Controls.Add(calendar);
Dim calendar As New SfCalendar()
tabPageAdv1.Controls.Add(calendar)
Tab placement
Windows Forms TabControl (TabControlAdv) provides an option to display tabs horizontally at the top or bottom and vertically at the left or right by setting the Alignment property of TabControlAdv.
//Tabs placement
tabControlAdv1.Alignment = TabAlignment.Bottom;
'Tabs placement
tabControlAdv1.Alignment = TabAlignment.Bottom
Left
Right
Top
Bottom
Edit header at run time
You can rename or edit the header at run time by enabling the LabelEdit property of TabControlAdv.
// Renaming header text.
this.tabControlAdv.LabelEdit = true;
' Renaming header text.
Me.tabControlAdv.LabelEdit = True
Multi-line tabs
You can arrange the tabs in multiple rows by enabling the Multiline property of TabControlAdv.
//Multiline tabs
tabControlAdv1.Multiline = true;
'Multiline tabs
tabControlAdv1.Multiline = True