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. How do I programatically select a Tab Page?

How do I programatically select a Tab Page?

Scheduled Pinned Locked Moved C#
questionwinformshelplearning
6 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.
  • P Offline
    P Offline
    postonoh
    wrote on last edited by
    #1

    I have 6 tabs on my windows forms. I want it to change tabs with I click the next button can you any help.

    Shelby Learning the Code!

    P 1 Reply Last reply
    0
    • P postonoh

      I have 6 tabs on my windows forms. I want it to change tabs with I click the next button can you any help.

      Shelby Learning the Code!

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Call SelectedTab and select the tab you want.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        Call SelectedTab and select the tab you want.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        P Offline
        P Offline
        postonoh
        wrote on last edited by
        #3

        private void Navigate() { //this.tabControl1.SelectedTab = this.tabPage1; //this.tabControl1.SelectedTab = this.tabPage2; //this.tabControl1.SelectedTab = this.tabPage3; //this.tabControl1.SelectedTab = this.tabPage4; //this.tabControl1.SelectedTab = this.tabPage5; } This is what I have. I need with I click the Next button it on to tab 2 if I press again tab 3 and so on. I click the previous button it goes backward.

        Shelby Learning the Code!

        P 1 Reply Last reply
        0
        • P postonoh

          private void Navigate() { //this.tabControl1.SelectedTab = this.tabPage1; //this.tabControl1.SelectedTab = this.tabPage2; //this.tabControl1.SelectedTab = this.tabPage3; //this.tabControl1.SelectedTab = this.tabPage4; //this.tabControl1.SelectedTab = this.tabPage5; } This is what I have. I need with I click the Next button it on to tab 2 if I press again tab 3 and so on. I click the previous button it goes backward.

          Shelby Learning the Code!

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          So keep track of which tab you're on and use that as the basis for navigation.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          P 1 Reply Last reply
          0
          • P Pete OHanlon

            So keep track of which tab you're on and use that as the basis for navigation.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            P Offline
            P Offline
            postonoh
            wrote on last edited by
            #5

            Need help in writing this.

            Shelby Learning the Code!

            M 1 Reply Last reply
            0
            • P postonoh

              Need help in writing this.

              Shelby Learning the Code!

              M Offline
              M Offline
              Member 2048894
              wrote on last edited by
              #6

              Name 2 buttons "btnPrev" and "btnNext". Name a tab control "tabControl1". Create "Click" event handlers for the two buttons and put the code in them like this:

              private void btnPrev_Click(object sender, EventArgs e)
              {
              if (tabControl1.SelectedIndex > 0)
              tabControl1.SelectedIndex--;
              }

              private void btnNext_Click(object sender, EventArgs e)
              {
              if (tabControl1.SelectedIndex < (tabControl1.TabCount - 1))
              tabControl1.SelectedIndex++;
              }

              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