TabControl
-
Hi I have a tabcontrol in my form that this tabcontrol has 7 tabpages ; I want to know how can i hide or unvisible or disable some tabpages of this tabcontrol?
I found this: _You can dynamically remove and inseret TabPages into the TabControl.TabPages collection to hide and show tabs at runtime.
TabPage tabPageSave = null;
private void button1_Click(object sender, EventArgs e)
{
//hide a tab by removing it from the TabPages collection
this.tabPageSave = tabControl1.SelectedTab;
this.tabControl1.TabPages.Remove(this.tabPageSave);
}private void button2_Click(object sender, EventArgs e)
{
//show a tab by adding it to the TabPages collection
if (this.tabPageSave != null)
{
int loc = tabControl1.SelectedIndex;
this.tabControl1.TabPages.Insert(loc, this.tabPageSave);
}
}_
using this google search phrase: c# winforms tabcontrol hide tabs Personally, I create TabItems manually instead of adding them in the designer, and then instantiate them in a List so I can manipulate them more logically, but it's essentially the same as what's happening in the code above..45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001