How to rename Tab control items in WinForms?
Renaming tabitems
You can programmatically set the TabPageAdv to edit mode by deriving the TabControlAdv and invoking the StartLabelEdit() function.
C#
void radioButtonAdv1_CheckChanged(object sender, EventArgs e) { if (this.radioButtonAdv1.Checked) { //Sets the TabControlAdv in the LabelEdit mode. this.tabControlAdv1.LabelEdit = true; this.tabControlAdv1.StartEdit(); } else if (this.radioButtonAdv2.Checked) //Disables the LabelEdit behavior of the TabControlAdv. this.tabControlAdv1.LabelEdit = false; } //Creates a custom control. public class MyTabControl : TabControlAdv { public MyTabControl() : base() { } //Sets the TabPageAdv in the edit mode. public void StartEdit() { StartLabelEdit(); } }
VB
Private Sub radioButtonAdv1_CheckChanged(ByVal sender As Object, ByVal e As EventArgs) If Me.radioButtonAdv1.Checked Then 'Sets the TabControlAdv in the LabelEdit mode. Me.tabControlAdv1.LabelEdit = True Me.tabControlAdv1.StartEdit() ElseIf Me.radioButtonAdv2.Checked Then 'Disables the LabelEdit behavior of the TabControlAdv. Me.tabControlAdv1.LabelEdit = False End If End Sub 'Creates a custom control. Public Class MyTabControl Inherits TabControlAdv Public Sub New() MyBase.New() End Sub 'Sets the TabPageAdv in the edit mode. Public Sub StartEdit() StartLabelEdit() End Sub End Class
The property named “LabelEdit” in the TabControlAdv should be enabled to set the TabPageAdv in edit mode.
Figure 1: TabControlAdv displayed in LabelEdit mode
Figure 2: LabelEdit mode is disabled in TabControlAdv
Samples:
C#: TabControlAdv_LabelEdit_C#
VB: TabControlAdv_LabelEdit_VB
Reference link: https://help.syncfusion.com/windowsforms/tabcontrol/customization
Conclusion
I hope you enjoyed learning how to rename Tab items in WinForms.
You can refer to our WinForms TabControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms TabControl example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!