[RESOLVED] How To Hide and Show TabPages
Hi Friends !
I have a Tabcontrol, where I want to hide and show different TabPages defending on different conditions. On each of the pages there is placed a usercontrol which wears the different buttons and textboxes... I'm needing.
I have triedmyTabControl.TabPages[num].Hide(); Which doesn't make any error. but also doesn't work
I have also tried myTabControl.Controls[i].Visible = false;
Also no reaction ?
So how to do it ?
[481 byte] By [
JonnyPoet] at [2007-11-20 9:41:10]

# 1 Re: [RESOLVED] How To Hide and Show TabPages
You cant; yo have to add/remove them from the container as you need them
Maintain a Collections.Generic.Dictionary<string, TabPage> separately, and then:
if(shouldShowMain)
myTabControl.TabPages.Add(dictionary["mainTab"])
Actualy, theres no need for using a dictionary, but in the situations where i was hiding and showing tabs, it worked out more handy because I could enumerate it to add or remove several in a loop; if you dont need this then maybe individual variables will do
cjard at 2007-11-9 11:34:32 >

# 2 Re: [RESOLVED] How To Hide and Show TabPages
You cant; yo have to add/remove them from the container as you need them...Thx such a lot, I was frightened it is in that way. And the idea using a dictionary is the best I've heard regarding that. Because its just as you say I have to hide show different pages at different circumstances and so having them in an dictionary is per sure the best practice for that. :thumb: :D :thumb: