-2

I'm programming a windows application program, using winforms c# I have a tab control that contains so many pages I need to hide some of these tabs from non-admin users, for example if user is an admin no pages will be hided, else page number 1 and 2 will be hided and other pages will be shown, I don't want to remove pages, just hide because in the program I made you can sign out without closing the program and sign in again as an admin

Box Box Box Box
  • 5,094
  • 10
  • 49
  • 67
  • 1
    You also follow this, there has a solution. http://stackoverflow.com/questions/552579/how-to-hide-tabpage-from-tabcontrol – Kamrul Hasan Jun 03 '16 at 22:12

3 Answers3

0

Please have a look at this thread.

As amazedsaint said:

Visiblity property has not been implemented on the Tabpages, and there is no Insert method also.

You need to manually insert and remove tab pages.

Here is a work around for the same.

http://www.dotnetspider.com/resources/18344-Hiding-Showing-Tabpages-Tabcontrol.aspx

Community
  • 1
  • 1
Julien P.
  • 35
  • 7
0

No way to hide it ,you will have to remove pages an re add them for admin user

tabControl.TabPages.Remove(tabPage);


tabControl.TabPages.Add(tabPage);
Shachaf.Gortler
  • 5,655
  • 14
  • 43
  • 71
0

As seen here you can however disable/enable tabs. While this won't make then invisible, you can restrict access. That should get you going in a workable direction.

I'd personally also put all the restricted tabs at the end, but that's just a point of personal taste.

Community
  • 1
  • 1
kyle_engineer
  • 280
  • 1
  • 11