SgDotNet
Singapore Professional .NET User Group -For Cool Developers

Hiding a tab in the tabcontrol.

rated by 0 users
This post has 1 Reply | 0 Followers

Top 100 Contributor
Posts 18
One92dot168dot0dot1 Posted: 09-17-2006 3:55 PM

Hi,  

Is there any way to hide or disable a tab of the tab control. ? (.NET 2.0)

Thanks.

 

 

I Just Got Started, but there's no stopping me now !!!
Top 100 Contributor
Posts 18
http://www.thescripts.com/forum/thread520467.html 
You can remove it with the following line of code

TabControl.TabPages.Remove(TabPage)

If you declare a form level variable you can also insert it back in at the correct index if you'll need it later.
Private tabOne As TabPage

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
tabOne = TabPage1
End Sub

Private Sub ButtonRemove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonRemove.Click
TabControl.TabPages.Remove(tabOne)
End Sub

Private Sub ButtonInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonInsert.Click
TabControl.TabPages.Insert(0, tabOne)
End Sub
I Just Got Started, but there's no stopping me now !!!
Page 1 of 1 (2 items) | RSS
Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems