Faisal Posted March 8, 2003 Posted March 8, 2003 Hoe to Hide a TabPage in a TabControl I have five tabpages on my tabcontrol and want to hide and show one of them on a button click Quote
*Gurus* divil Posted March 8, 2003 *Gurus* Posted March 8, 2003 You can't just hide and show tabs in a tabcontrol - it was never meant to operate that way. Nor can you disable individual tabs. The best you can do is to remove them all and add the ones you need, or to not show some in the first place. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
aewarnick Posted April 3, 2003 Posted April 3, 2003 You cannot Hide() the tab but you can Hide() the tab page itself. I did that with some of my tab pages if the password the user entered was incorrect. Quote C#
*Experts* Nerseus Posted April 3, 2003 *Experts* Posted April 3, 2003 Neither Hide() nor setting Visible=False will work with TabPages. You can remove them through the TabControl's Controls collection or the TabPages collection using the Remove method. For example, use one of the two lines below (they do the same thing): tabControl1.TabPages.Remove(tabPage2); // OR tabControl1.Controls.Remove(tabPage2); Keep in mind that if you want to add the tabpages back in later, you have to add them in the order you want them. That may mean removing them all and adding them back in one at a time. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Ariez Posted April 7, 2003 Posted April 7, 2003 Make a procedure like: exposeContrls(Page as control) to expose the controls dynamically with page.controls.add...etc.. then you can remove and add any tabpage and load its interface. Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.