469,607 Members | 1,882 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,607 developers. It's quick & easy.

How to open new Form and close current Form?

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.
Nov 17 '05 #1
3 19085
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:
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.


Nov 17 '05 #2
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" <la***********@web.de> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
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:
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.

Nov 17 '05 #3
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" <ka**@hotmail.com> wrote in message
news:uC**************@tk2msftngp13.phx.gbl...
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.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andras Gilicz | last post: by
3 posts views Thread by Leonard | last post: by
6 posts views Thread by Kenneth Courville | last post: by
reply views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.