Value
If LCase(Direction) = "up" Then
iUpDown = 1
Else
iUpDown = -1
End If
MultiPage1.Pages(iCurrPage + iUpDown).Visible = True
MultiPage1.Pages(iCurrPage).Visible = False
End Sub
This method simply looks at the value of our CurrentPage property and adds or subtracts
1 based upon the Direction argument that is passed into the method.
CHAPTER 4 n USERFORMS 185
The cmdPrevious button??™s Click event looks very similar:
Private Sub cmdPrevious_Click()
Dim iPrevious As Integer
StoreData
iPrevious = m_oWizard.PreviousPage
Me.MultiPage1.Value = m_colSteps(CStr(iPrevious)).Order - 1
Me.MultiPage1.Pages((m_colSteps(CStr(iPrevious)).Page) - 1).Caption = ??
m_colSteps(CStr(iPrevious)).Caption
ShowNextPage "down"
End Sub
The only difference is that we are passing the keyword down to the ShowNextPage method
so that we move the user in the proper direction.
Let??™s add one last event handler to assist us with our navigation. Whenever we change
pages on a MultiPage control, the control??™s Change event fires.We??™ll use that event to grab the
value of the current page and store it in our m_oWizard object??™s CurrentPage property.
Add the following code to the MultiPage1 control??™s Change event:
Private Sub MultiPage1_Change()
m_oWizard.CurrentPage = MultiPage1.Value + 1
End Sub
Now that we have our navigation working, let??™s give it a try:
1. With the UserFormopen in Design view, click the Run button on the Standard toolbar
or press the F5 key.
2. Once the form is open, click the Next Button to move to the second step in our wizard,
as defined on our configuration worksheet.
Pages:
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194