Microsoft Office Tutorials and References
In Depth Information
Making a Wizard with Tabbed Control
Lets start with the btnNext:
Private Sub btnNext_Click()¶¶
' As the button is above the tabbed pages,¶
' the page value can be tested to detect what action is necessary¶
Select Case Me.tabWizard¶
Case 0¶
Case 1¶
' test if the extra page needs to be displayed¶
If Me.fraExplain = 1 Then¶
End If¶
Case 2¶
End Select¶
' Set the buttons fitting to the page¶
Call SetButtons¶
End Sub¶
A simple SELECT CASE is used to determine the page in focus, and to set the
focus to the next page. Because the radio button does interfere, an extra IF is
needed. Finally the enabling of the buttons is moved to a procedure because it
saves duplication of work when doing the btnPrev code.
This is the btnPrev code:
Private Sub btnPrev_Click()¶
' Previous always activates the previous page, except¶
' when no explanation was requested¶
Me.tabWizard.Pages(Me.tabWizard - 1).SetFocus¶
If Me.tabWizard > 0 And Me.fraExplain <> 1 Then¶
' subtract again to skip the explanation page¶
Me.tabWizard.Pages(Me.tabWizard - 1).SetFocus¶
End If¶
Call SetButtons¶
End Sub¶
Normally, lowering the page number by one is sufficient. If the explanation
radio button is pressed, then one additional subtraction must be made. The
btnPrev is disabled on the first page so it is not possible to move before the first
page. Please keep in mind that the pages are zero-base numbered; in other
words, the first page is number 0, the second is number 1, and so on.
Search JabSto ::

Custom Search