want to hide a tabpage in a tabcontrol collection on form load RRS feed

  • Question

  • I would like to have a tabcontrol contain TabPages, some of which will be visible and some of which will be invisible at any time.

    I have a TabPage in the Tabcontrol collection which I don't want showing up on form load.

    Me.TabControlRight.TabPages.Item("TabPagePreview").Hide()  doesn't work.  

    Thanks for suggestions.  -greg



    Monday, October 2, 2006 6:48 PM


  • Me.TabControlRight.TabPages.Remove(Me.TabPageTreeView)

    Monday, October 2, 2006 7:04 PM

All replies

  • Try with


    For Example you create the tabcontrol then you create a tabpage named mytabpage then

    use the code Me.mytabpage.hide()

    Monday, October 2, 2006 6:54 PM
  • Me.TabControlRight.TabPages.Remove(Me.TabPageTreeView)

    Monday, October 2, 2006 7:04 PM
  • The hide function of tabpages doesn't work. Microsoft is aware of it (i think that i have read that somewhere).

    Instead you have to remove it, and if you want to show it again you have to add it..

    If you use lets say tabControl1 and tabpage1 the code for "hiding" would be


    And then when you "show" it again use:


    Hope the hide function is working in service pack 1 (the beta has just been released)

    Wednesday, October 4, 2006 11:43 PM
  • Thanks Dan!

    I was having such a problem with TabPages that I ended up just using TabPages for the selectedindex event in order to do the following after adding controls to a collection within a single Panel at runtime.

    Select Case TabControlLeft.SelectedIndex

          Case 0 'Setup

             Me.Panel.Controls.Item("ctl1").Visible = False

             Me.Panel.Controls.Item("ctl1").Visible = True

    I was really hoping to be able to use TabPages as Containers but I had to change the design. And its always hard to get the Docking and Anchoring right when you have to use more controls than you would like to.

    Not sure if any of that made sense.  thanks for letting me know about that hide issue !  -greg

    Wednesday, October 4, 2006 11:52 PM