Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. TabControl

TabControl

Scheduled Pinned Locked Moved C#
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    farokhian
    wrote on last edited by
    #1

    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?

    realJSOPR 1 Reply Last reply
    0
    • F farokhian

      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?

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups