I like to use the SSTab control to make my Wizard-like projects. It's extremely easy to do and, in my mind, is easier to understand than VB6's Wizard project.
So, first we start our new project: Start a new project (standard EXE)
And add the sstab control to the project: Project -> components Browse -> tabctrl32 (system32 directory)
Add a tab control to the form (sstab1)
Change no. of tabs to reflect no. of wizard steps
Add the following to the form_load event: (this hides the tabs in the tab control so that the user must navigate the project with the next button (ie: Wizard style))
Private Sub Form_Load() SSTab1.TabHeight = 1 SSTab1.TabMaxWidth = 15 SSTab1.Width = Me.Width + 200 SSTab1.Left = -100 SSTab1.Tab = 0 End Sub
Add a command button (bottom right of tab) Name: cmdNext Caption: Next Make a copy of this button on each tab -as a control array Double click next button and add the following code:
Private Sub cmdNext_Click(Index As Integer) Dim tab_prepared As Boolean If prepare_tab(Index + 1) Then SSTab1.Tab = Index + 1 Debug.Print "User pressed Next " & Str(Index) Else Debug.Print "Unable to prepare tab " & Str(Index + 1) End If End Sub
And, of course, we need the prepare_tab function: Private Function prepare_tab(tab_no As Integer) As Boolean Select Case tab_no Case 1 'code to prepare tab number 1 Case 2 'code to prepare tab number 2 End Select prepare_tab = True
Exit Function errorhandler: Debug.Print "Error preparing tab number " & Str(tab_no) prepare_tab = False End Function
Add a control array of 'back buttons in the same manner but starting on tab number 1 (not zero). The code for the back button could be: Private Sub cmdBack_Click(Index As Integer) SSTab1.Tab = Index End Sub
And viola! A wizard that is easy to navigate in the design environment and looks good at run time.