Hallo, mit dieser Lösung kannst Du hin und her schalten,
weiterhin hat der Button immer eine korrekte Beschriftung!
$title = "Tab - Switch 2 "
Global $tate = 0, $TabSheet[2]
GUICreate($title, 600, 450)
$button = GUICtrlCreateButton($title, 10, 10, 200, 25)
$bnClose = GUICtrlCreateButton($title & "Beenden", 390, 10, 200, 25)
$Tab = GUICtrlCreateTab(10, 50, 580, 390)
$TabSheet[0] = GUICtrlCreateTabItem("TabItem 1")
GUICtrlCreateButton("Button 1", 72, 168, 121, 22)
$TabSheet[1] = GUICtrlCreateTabItem("TabItem 2")
GUICtrlCreateLabel("Label 1", 40, 88, 36, 17)
GUICtrlCreateInput("Input 1", 96, 80, 73, 21)
GUICtrlCreateLabel("Label 2", 40, 112, 36, 17)
GUICtrlCreateInput("Input 2", 96, 112, 73, 21)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3, $bnClose
MsgBox(64, $title, "Viel Spaß wünscht RR04 !" & @TAB, 3)
ExitLoop
Case $button
$tate = BitXOR($tate, 0, 1)
For $k = 0 To 1 ;i statisch kein Ubound
GUICtrlSetState($TabSheet[$tate], 16)
GUICtrlSetData($button, "Wechseln zu TabItem " & BitXOR($tate, 0, 1) + 1)
Next
EndSwitch
WEnd
; Ende