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. Hiding/dynamically adding a tab page..??

Hiding/dynamically adding a tab page..??

Scheduled Pinned Locked Moved C#
question
4 Posts 3 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.
  • V Offline
    V Offline
    vlusardi
    wrote on last edited by
    #1

    tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...??? thanks, vince

    C N 2 Replies Last reply
    0
    • V vlusardi

      tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...??? thanks, vince

      C Offline
      C Offline
      ctescu
      wrote on last edited by
      #2

      If the TabControl is named "tabControl" , the code for closing is : // verify if the TabPages exist // if we try to close a non-open tab will have error's if (this.tabControl.TabPages.Count != 0) this.tabControl.TabPages.Remove(this.tabControl.SelectedTab); //SelectedTab is the selected tab tabControl.TabPages[] is the // tab , if you whant other tab

      V 1 Reply Last reply
      0
      • C ctescu

        If the TabControl is named "tabControl" , the code for closing is : // verify if the TabPages exist // if we try to close a non-open tab will have error's if (this.tabControl.TabPages.Count != 0) this.tabControl.TabPages.Remove(this.tabControl.SelectedTab); //SelectedTab is the selected tab tabControl.TabPages[] is the // tab , if you whant other tab

        V Offline
        V Offline
        vlusardi
        wrote on last edited by
        #3

        thanks for the reply, but that's not quite what I'm looking for... I need to have either a hidden tab page that can be unhidden, or the ability to create a tab page with a listbox containing error strings... Don't need to remove a tab page... thanks for any further suggestions..

        1 Reply Last reply
        0
        • V vlusardi

          tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...??? thanks, vince

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          vlusardi wrote: or a way to dynamically add a tab page to a tab control...??? Sure, try something like this, it works:

          		for(int i = 0; i < 5;i++)
          		{
          			TabPage tbpage = new TabPage("test" + i);
          			this.tabControl1.TabPages.Add(tbpage); 
          		}
          

          -Nick Parker

          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