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. Programmatically change a tab control that exists on another form.

Programmatically change a tab control that exists on another form.

Scheduled Pinned Locked Moved C#
question
8 Posts 4 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.
  • D Offline
    D Offline
    Derek Smigelski
    wrote on last edited by
    #1

    How do I programmatically change a tab control that exists on another form?

    D 1 Reply Last reply
    0
    • D Derek Smigelski

      How do I programmatically change a tab control that exists on another form?

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      What about the tab control do you want to change? One of the tabs, the color, the placement? What? Norm Almond: I seen some GUI's in my life but WTF is this mess ;-) Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough:) Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children:laugh: Leppie:My sister is 25:eek: -Norm on the MailMagic GUI

      D 1 Reply Last reply
      0
      • D David Stone

        What about the tab control do you want to change? One of the tabs, the color, the placement? What? Norm Almond: I seen some GUI's in my life but WTF is this mess ;-) Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough:) Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children:laugh: Leppie:My sister is 25:eek: -Norm on the MailMagic GUI

        D Offline
        D Offline
        Derek Smigelski
        wrote on last edited by
        #3

        One of the tabs.

        L 1 Reply Last reply
        0
        • D Derek Smigelski

          One of the tabs.

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Derek Smigelski wrote: One of the tabs. We just need a "little" bit more details, then we can answer you :) Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.

          D 1 Reply Last reply
          0
          • L leppie

            Derek Smigelski wrote: One of the tabs. We just need a "little" bit more details, then we can answer you :) Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.

            D Offline
            D Offline
            Derek Smigelski
            wrote on last edited by
            #5

            I have a parrent form and child form (with a tree control) docked left on the parent form. The 5 tabbed tab control is on the parent form. When a user selects a node in the tree say "Node 1", I want the "Tab 1" to be selected as a result of what the user selected in the tree control. If use selects "node 5" tab 5 will be select automatically.

            L 1 Reply Last reply
            0
            • D Derek Smigelski

              I have a parrent form and child form (with a tree control) docked left on the parent form. The 5 tabbed tab control is on the parent form. When a user selects a node in the tree say "Node 1", I want the "Tab 1" to be selected as a result of what the user selected in the tree control. If use selects "node 5" tab 5 will be select automatically.

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              OK, thats a bit better :)

              treeView.AfterSelect += new TreeViewEventHandler( NodeSelected );

              void NodeSelected(TreeViewEventArgs e)
              {
              tabControl.SelectedIndex = e.Node.Index;
              }

              Now this will select the 2nd tab if u select the second node. You can do your own mapping to your liking :) Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.

              D 1 Reply Last reply
              0
              • L leppie

                OK, thats a bit better :)

                treeView.AfterSelect += new TreeViewEventHandler( NodeSelected );

                void NodeSelected(TreeViewEventArgs e)
                {
                tabControl.SelectedIndex = e.Node.Index;
                }

                Now this will select the 2nd tab if u select the second node. You can do your own mapping to your liking :) Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.

                D Offline
                D Offline
                Derek Smigelski
                wrote on last edited by
                #7

                Can't seem it find aname for the entire tab control (like in your example you have tabcontrol.) I have 5 tabs eached with a different name. Plus I get errors on ( NodeSelected ); saying more parameters are required.

                G 1 Reply Last reply
                0
                • D Derek Smigelski

                  Can't seem it find aname for the entire tab control (like in your example you have tabcontrol.) I have 5 tabs eached with a different name. Plus I get errors on ( NodeSelected ); saying more parameters are required.

                  G Offline
                  G Offline
                  Gaul
                  wrote on last edited by
                  #8

                  Just to chip in, tabcontrol refers to the name of your TabControl variable (System.Windows.Forms.TabControl tabcontrol) as defined in your form class. Gaul Gaulles Technologies, Inc http://www.gaulles.com

                  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