Click here to Skip to main content
15,914,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: Transition between forms, next, back buttons Pin
Saamir29-Aug-06 5:02
Saamir29-Aug-06 5:02 
AnswerRe: Transition between forms, next, back buttons Pin
Nader Elshehabi29-Aug-06 7:32
Nader Elshehabi29-Aug-06 7:32 
Hello

With all respect and regards to Sebestian, the model you are asking about is not a bad idea at all. It's caled the wizard UI model, and it's already implemented in almost all installers and several other well known applications, when simplifying a task for the user is required.

Anyway, there are two ways that I know of to implement this model.

1- As you suggested. To make a form for each step, and hide =/show each form according to the user's choice. Two scenarios:
You are implementing a wizard in your main form. In this case you will make Form objects in your main Form's class, like this:
Ps. a- Step1Form is another form that you design in another file.
b- Make in each step the back button as Cancel, and next as OK buttons.

public partial class MyMainForm : Form
{
    private Step1Form Step1;
    private Step2Form Step2;
    private Step3Form Step3;
    
    MyMainForm()
    {
        Step1 = new Step1Form()
        Step2 = new Step2Form()
        Step3 = new Step3Form()
    }

    public void MyWizardMethod()
    {
        this.Hide();
        while(true)
        {
            if(Step1.ShowDialog() == DialogResult.Ok && Step2.ShowDialog() == DialogResult.Ok && Step3.ShowDialog() == DialogResult.Ok)
                {
                    //You code goes here
                    break;                    
                }
            else if(/*make some condition here if you want to cancel the wizard and break the loop*/)
            {
            }
            else
                continue;
        }
        //More code can go here
        this.Show();
    }
}

NB. If you don't have a main Form for the wizard, you can make the last step -ie. the result- as the main form.

2- Second way of making a wizard is;
a- Make a single form
b- Put each step's controls in a panel or a groupbox
c- Show/Hide according to the current step

RegardsRose | [Rose]

QuestionRemoting with IPC Pin
ejuanpp29-Aug-06 3:34
ejuanpp29-Aug-06 3:34 
QuestionInt16 is not Int16 are you missing a cast? Pin
MY120129-Aug-06 3:27
MY120129-Aug-06 3:27 
AnswerRe: Int16 is not Int16 are you missing a cast? Pin
Dan Neely29-Aug-06 3:37
Dan Neely29-Aug-06 3:37 
GeneralRe: Int16 is not Int16 are you missing a cast? Pin
User 665829-Aug-06 3:52
User 665829-Aug-06 3:52 
AnswerRe: Int16 is not Int16 are you missing a cast? [modified] Pin
User 665829-Aug-06 3:46
User 665829-Aug-06 3:46 
GeneralRe: Int16 is not Int16 are you missing a cast? Pin
Dave Kreskowiak29-Aug-06 4:26
mveDave Kreskowiak29-Aug-06 4:26 
AnswerRe: Int16 is not Int16 are you missing a cast? Pin
Mike Dimmick29-Aug-06 6:46
Mike Dimmick29-Aug-06 6:46 
QuestionDeclare class as partial class in CodeDOM Pin
Ista29-Aug-06 3:23
Ista29-Aug-06 3:23 
AnswerRe: Declare class as partial class in CodeDOM Pin
Ista29-Aug-06 3:26
Ista29-Aug-06 3:26 
GeneralRe: Declare class as partial class in CodeDOM Pin
Marcos Accioly29-Aug-06 3:29
Marcos Accioly29-Aug-06 3:29 
QuestionUsing .NET's WMI to Identify Pen-Drive's Unique ID Pin
Marcos Accioly29-Aug-06 3:22
Marcos Accioly29-Aug-06 3:22 
AnswerRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
mav.northwind29-Aug-06 8:25
mav.northwind29-Aug-06 8:25 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
Marcos Accioly29-Aug-06 9:09
Marcos Accioly29-Aug-06 9:09 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
Dave Kreskowiak29-Aug-06 9:17
mveDave Kreskowiak29-Aug-06 9:17 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
mav.northwind29-Aug-06 10:24
mav.northwind29-Aug-06 10:24 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
Marcos Accioly29-Aug-06 10:29
Marcos Accioly29-Aug-06 10:29 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
mav.northwind29-Aug-06 10:35
mav.northwind29-Aug-06 10:35 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
Marcos Accioly30-Aug-06 3:48
Marcos Accioly30-Aug-06 3:48 
GeneralRe: Using .NET's WMI to Identify Pen-Drive's Unique ID Pin
mav.northwind1-Sep-06 4:11
mav.northwind1-Sep-06 4:11 
QuestionHow to pass parameters to MATLAB function (.dll file) Pin
Jr.Allam29-Aug-06 2:59
Jr.Allam29-Aug-06 2:59 
Questionhow to save response Pin
Yustme29-Aug-06 2:57
Yustme29-Aug-06 2:57 
AnswerRe: how to save response Pin
led mike29-Aug-06 4:39
led mike29-Aug-06 4:39 
AnswerRe: how to save response Pin
engsrini29-Aug-06 4:41
engsrini29-Aug-06 4:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.