Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
UpdateButtons()
End Sub
Private Sub UpdateButtons()
If sftTabs1.Current = 3 Then
' on this page we honor the check boxes
buttonNext.Enabled = checkBoxNext.Checked
buttonBack.Enabled = checkBoxBack.Checked
Else
' otherwise enable back/next
buttonBack.Enabled = sftTabs1.Current > 0
buttonNext.Enabled = True
End If
End Sub
Private Sub buttonBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonBack.Click
sftTabs1.Current = sftTabs1.Current - 1
End Sub
Private Sub buttonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonCancel.Click
If Windows.Forms.DialogResult.Yes = MessageBox.Show("Are you sure you want to quit?", "Wizard", MessageBoxButtons.YesNo) Then
Application.Exit()
End If
End Sub
Private Sub buttonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonNext.Click
If sftTabs1.Current = sftTabs1.Count - 1 Then
' on the last page we exit
Application.Exit()
Else
' otherwise just go to the next tab label
sftTabs1.Current = sftTabs1.Current + 1
End If
End Sub
Private Sub sftTabs1_Switched(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.Switched
' a new tab page is active
' update next/back button status
UpdateButtons()
' update Next/Finish button caption
If sftTabs1.Current = sftTabs1.Count - 1 Then
' we have reached the last page
buttonNext.Text = "&Finish"
Else
buttonNext.Text = "&Next >"
End If
End Sub
Private Sub checkBoxNext_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles checkBoxNext.CheckedChanged
UpdateButtons()
End Sub
Private Sub checkBoxBack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles checkBoxBack.CheckedChanged
UpdateButtons()
End Sub
Private Sub buttonStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonStart.Click
sftTabs1.Current = sftTabs1.TabCollection("First").Index
End Sub
Private Sub buttonEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonEnd.Click
sftTabs1.Current = sftTabs1.TabCollection("Last").Index
End Sub
End Class