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. Windows Forms
  4. Managing tabs in a multiline tab control

Managing tabs in a multiline tab control

Scheduled Pinned Locked Moved Windows Forms
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.
  • R Offline
    R Offline
    ruanr
    wrote on last edited by
    #1

    Hi all, I have a tabcontrol with a lot of tabs which may be added and removed dynamically. I'm using a multiline tab control due to the amount of tabs involved, and I would like to simple be able to add a tab to either the top or bottom row of tabs programatically. Is that at all possible? Thanks..

    L 1 Reply Last reply
    0
    • R ruanr

      Hi all, I have a tabcontrol with a lot of tabs which may be added and removed dynamically. I'm using a multiline tab control due to the amount of tabs involved, and I would like to simple be able to add a tab to either the top or bottom row of tabs programatically. Is that at all possible? Thanks..

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      ruanr wrote:

      Is that at all possible?

      Yup. Did you run into a non-working insert method? If yes, then there's a workaround[^].

      IntPtr h = tabControl.Handle;
      tabControl.TabPages.Insert(0, "test");

      Alternatively, you could move pages around as shown below :)

      var tabControl = new TabControl();
      tabControl.Parent = this;
      tabControl.Dock = DockStyle.Fill;
      tabControl.Multiline = true;
      Controls.Add(tabControl);

      // Create some tabs
      tabControl.TabPages.Add("bla");
      tabControl.TabPages.Add("bla2");
      tabControl.TabPages.Add("bla3");

      // Swap tab 0 & 1
      var temp = tabControl.TabPages[1];
      tabControl.TabPages[1] = tabControl.TabPages[0];
      tabControl.TabPages[0] = temp;

      I are Troll :suss:

      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