I'm about to start developing a section of an app, where the most complex part involves multiple steps to complete the task. I'm looking at splitting this task into about 7 steps, with each step represented by a form, with a back / next button, to show the previous/ next form. The flow will go something like this:
add client. If already exists, show form of existing clients, and select. If not, add new client.
enter company client is working for. As above: if not already existing, enter a new company.
etc...
So i can present this as a menu down the side, showing the steps that have been completed or need completing, and the rest of the screen showing the details / textboxes / existing data etc.
I guess the best way to describe it would be a data entry wizard, but no data will be actually entered into the database until the final step is confirmed and all information is complete and verified.
I was wondering the best way to implement such a scenario. I was thinking of an mdi app, where each mdi child is a form for each step of the data entry process, so a form for add client, a form for add company etc. However, the larger picture is that this will be going in to an mdi app itself - can you have an mdi, with children, as a child of another mdi form? Whats the best way to implement the data entry process? I was thinking maybe an array, or (uurgh) global public booleans in the mdi parent which are set to true when a form is completed successfully - but is there a more elegant (and hopefully OO) solution?
Using a new form for each step of the wizard would be a waste, IMHO.
When I create a wizard style application, I generally create a group box array (or a picture box since controls in a group box to not render properly with an XP theme, but that is another post). For example, you mention 7 steps. I would create 7 group boxes in an array (0-6).
Then, I maintain a global counter variable. At startup this counter is set to 0 by default. When the user clicks "Next" I increment the counter. WHen the user clicks "Back" I decrement the counter. After each action (load, back, next) I call a sub called "ShowFrame()". This sub would look like this:
VB Code:
Sub ShowFrame()
Dim I As Integer
For I = 0 To grpBox.Ubound
grpBox(I).Visible = I = intCounter
Next
Exit Sub
There is your wizard app, without having to resort to loading/unloading a form on each step.
Last edited by BradBrening; Sep 22nd, 2005 at 05:18 PM.
Reason: update