Connect with Expertise | Find Experts, Get Answers, Share Insights

How to open new Form and close current Form?

Kimelia
 
Posts: n/a
#1: Nov 17 '05
I want to create something like wizard, which will ask one question and
proceed to the next question.
So, it's like showing Form A (Question 1), then when the user press "Next"
button, I want to close Form A (Question 1), and show Form B (Question 2).

Sorry to ask if this is too simple, as I am still learning C#.

Thanks and have a nice day.



Lars Behrmann
 
Posts: n/a
#2: Nov 17 '05

re: How to open new Form and close current Form?


Hi Kimelia,

i think you went into the wrong way. If you plan
to write a wizard you better should make use of
the Panel Class. For every user input dialog place one
panel within the form. Set all panels Visible = false
but the first panel Visible = true. After
the user filled out the inputs of the first panel
and press next you will hide the first panel and show
the secon and so on and so on.

Hope that helps

Lars Behrmann

_________________
Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net

Kimelia schrieb:
[color=blue]
> I want to create something like wizard, which will ask one question and
> proceed to the next question.
> So, it's like showing Form A (Question 1), then when the user press "Next"
> button, I want to close Form A (Question 1), and show Form B (Question 2).
>
> Sorry to ask if this is too simple, as I am still learning C#.
>
> Thanks and have a nice day.[/color]

Scott Coonce
 
Posts: n/a
#3: Nov 17 '05

re: How to open new Form and close current Form?


Another way would be to show Form1 and then a completely different Form2.

I did this in the following way for a project.

First, create an "EntryPoint" (or whatever) class:

class EntryPoint{
static void Main(string[] args) {
using(Form1 f1 = new Form1()) {
// do something with form 1
}
using(Form2 f2 = new Form2()) {
// do something with form 2
}
}
}
Second, set this class as the startup object in VS. I did something like
this and it worked well for my purposes.

"Lars Behrmann" <lars_behrmann@web.de> wrote in message
news:1129793327.533759.12140@z14g2000cwz.googlegro ups.com...[color=blue]
> Hi Kimelia,
>
> i think you went into the wrong way. If you plan
> to write a wizard you better should make use of
> the Panel Class. For every user input dialog place one
> panel within the form. Set all panels Visible = false
> but the first panel Visible = true. After
> the user filled out the inputs of the first panel
> and press next you will hide the first panel and show
> the secon and so on and so on.
>
> Hope that helps
>
> Lars Behrmann
>
> _________________
> Nothing is impossible. UML is the key for all your problems.
> AODL - Make your .net apps OpenOffice ready
> http://aodl.sourceforge.net
>
> Kimelia schrieb:
>[color=green]
>> I want to create something like wizard, which will ask one question and
>> proceed to the next question.
>> So, it's like showing Form A (Question 1), then when the user press
>> "Next"
>> button, I want to close Form A (Question 1), and show Form B (Question
>> 2).
>>
>> Sorry to ask if this is too simple, as I am still learning C#.
>>
>> Thanks and have a nice day.[/color]
>[/color]


Ignacio Machin \( .NET/ C# MVP \)
 
Posts: n/a
#4: Nov 17 '05

re: How to open new Form and close current Form?


Hi,

IIRC there is a library that let you do this. Somebody posted the link here
a time ago, check google groups .

What you can do is hide the calling form before showing the "next" one. but
check first the archives !!!

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"Kimelia" <kaka@hotmail.com> wrote in message
news:uCUcgYU1FHA.2616@tk2msftngp13.phx.gbl...[color=blue]
>I want to create something like wizard, which will ask one question and
> proceed to the next question.
> So, it's like showing Form A (Question 1), then when the user press "Next"
> button, I want to close Form A (Question 1), and show Form B (Question 2).
>
> Sorry to ask if this is too simple, as I am still learning C#.
>
> Thanks and have a nice day.
>
>[/color]


Closed Thread