Button that swaps between tabs

I have various tabpages in my program, and i wish to code a button that goes to the next tabpage
when i press it...
How to do it Thanks


Answer this question

Button that swaps between tabs

  • Kinlan

    XiON, glad this worked for you,

    One thing I want to point out, and not that it is a big deal, but I'm sure you picked up on it.

    I mentioned that I had 5 tabs when in fact I have 6, and the Tab index starts from 0.

    Also, in my application, if I wanted to use the shift key to go to previous tabs, I am checking for

    Keys.F12, Keys.Shift and Control.ModifierKeys.

    then instead of incrementing the SelectedIndex I decrement it.

    Regards

    tattoo


  • IntMain

    Works perfectly, thanks ;)

  • jods

    I created a similar thing but used function keys on my tabs, so on each Tab my F12 key would switch to the next tab or Shift F12 takes me to the previous tab. It should be no problem to do with buttons though.

    Make each F Key or button (whichever you prefer) call a routine as I did. Nexttab(). My Application had 5 different tabs, you can substitute that number with your number of tabs.

    Private Sub Nexttab()
    If Tabcontrol1.SelectedIndex < 5 Then
    Tabcontrol1.SelectedIndex = Tabcontrol1.SelectedIndex + 1
    Else
    Tabcontrol1.SelectedIndex = 0
    End If
    End Sub

    Hope this helps..

    Tattoo


  • Button that swaps between tabs