简体   繁体   中英

How to move between different tabs with Next button in Visual Studio with VB.net?

I have looked all over the internet and cannot find a solution. I am hoping to have a button that has code that is something like this. Anyone know how to make this happen?

 Private Sub Button1_Click()

 Dim TabPosition as int

 TabPosition = Tabcontrol1.SelectedTab.Value

       if TabPosition = 1

 Then TabControl1.SelectedTab = TabPage2

       ElseIf TabPosition = 2

 Then TabControl1.SelectedTab = TabPage3

 End If

 End Sub

You can use the SelectedIndex property to know your position:

If TabControl1.SelectedIndex = TabControl1.TabCount - 1 Then
  TabControl1.SelectedTab = TabControl1.TabPages(0)
Else
  TabControl1.SelectedTab = TabControl1.TabPages(TabControl1.SelectedIndex + 1)
End If

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM