)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide TabPageAdv when TabPageAdvCollection count is reduced to one in WinForms TabControlAdv?

Platform: WinForms |
Control: TabControlAdv |
Published Date: November 21, 2014 |
Last Revised Date: February 3, 2020

Hide tab page in TabControlAdv

In TabControlAdv, when the TabPageAdvCollection count is reduced to one it can be hidden by handling its SelectedIndexChanged event and using TabVisible property in TabPageAdv.

C#

private void tabControlAdv1_SelectedIndexChanged(object sender, EventArgs e)
{
   if(tabControlAdv1.TabCount == 1)
   {
      tabControlAdv1.SelectedTab.TabVisible = false;
   }
}
private void button1_Click(object sender, EventArgs e)
{
   tabControlAdv1.SelectedTab.TabVisible = true;
   TabPageAdv page = new TabPageAdv();
   page.Text = "NewTab";
   tabControlAdv1.TabPages.Add(page);
}

VB

Private Sub tabControlAdv1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles tabControlAdv1.SelectedIndexChanged
   If tabControlAdv1.TabCount = 1 Then
      tabControlAdv1.SelectedTab.TabVisible = False
   End If
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
   tabControlAdv1.SelectedTab.TabVisible = True
   Dim page As New TabPageAdv()
   page.Text = "NewTab"
   tabControlAdv1.TabPages.Add(page)
End Sub

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/TabControlAdv1797729526.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon