Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Tabcontrol - Hide TabPage Label (Button) Only

Tabcontrol - Hide TabPage Label (Button) Only

Tabcontrol - Hide TabPage Label (Button) Only

I would like to hide the label or button portion only of a tabpage, not remove the entire page. I want to control through the program which page is visible and not let the user click on the label (Buttons) to change tab pages. It seems like there should be a property setting somewhere for this. Something like TabAlignment = "None". I guess I could position the tab control so the user cannot see the label (buttons), just thought there might be an easier way. Maybe an override of the paint method, but I haven't done that before. Any help or suggestions would be appreciated.

Northwest Ohio

RE: Tabcontrol - Hide TabPage Label (Button) Only

There is no way to do it that I know of.

If you're simply wanting to control through code which controls are visible at what time, then just put some panel controls onto your form, fill them with controls, and show or hide them from your code based on your business rules.

RE: Tabcontrol - Hide TabPage Label (Button) Only

Thanks RiverGuy. I played around with moving the tab control so you couldn't see the labels and it didn't look too bad. The tab control is already built and populated with other controls so I really don't want to change it at this point in time. Will test some more and see if moving the tab control will look OK.

Northwest Ohio

RE: Tabcontrol - Hide TabPage Label (Button) Only

Forgive me if I'm not understanding your question completely. You said you don't want to remove the entire page but what difference would that make if the tab label/button is not visible? The user would not be able to select it anyway would they? Couldn't you just Remove and Add the TabPage to the TabControl's Controls to control the visibility?


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Static tabPage2Visible As Boolean = True

        If (tabPage2Visible) Then
        End If
        tabPage2Visible = (Not tabPage2Visible)

    End Sub

RE: Tabcontrol - Hide TabPage Label (Button) Only

Yes I could just add and remove the pages, but the tab page label would still be visible for the page just added. I don't want the user to see the label of any of the tab pages. I want the program to determine which page is visible. Not a real big deal, just thought it would look better without the label showing.

Northwest Ohio

RE: Tabcontrol - Hide TabPage Label (Button) Only

How about setting the tab control's SizeMode to Fixed and its ItemSize to 1,1?

RE: Tabcontrol - Hide TabPage Label (Button) Only

Thanks Dave, that will help me hide them because they are so small, but you can still click them. I'm already using the tabcontrol's drawitem to change the background color of the label, maybe I can do something in there to really hide them.

Northwest Ohio

RE: Tabcontrol - Hide TabPage Label (Button) Only

Did you end up writing something? I have a form with TabControl already designed, but now the requirements changed and in one situation I only want to show the first page and in another two other pages.

What would be my simple solution here - I'm still a newbie in WinForms.

RE: Tabcontrol - Hide TabPage Label (Button) Only

I never really finished that test form. If it's not too much trouble then I would add and remove pages as Dave suggested. You could place the tab control at the top of the form so you cannot see the tabs. I did play around with making the itemsize (1,1). You can still see them and click on them but they are very small. I placed a label control in front of the tab control to hide all of the tabs. This seemed to work ok, just make sure if you allow any movement or resizing that thew label stays in place. I reposition the label in the form load so it would always be in the correct spot. You could also reposition it in a re-size event.

Northwest Ohio

RE: Tabcontrol - Hide TabPage Label (Button) Only

In the first case where I only wanted to show one page, I removed two other pages and set Text property of TabControl to 100 spaces.

I applied similar technique in the case of 2 pages.

It is not a perfect solution, but OK with me.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close