How to open new Form and close current Form?

K

Kimelia

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.
 
L

Lars Behrmann

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
 
S

Scott Coonce

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.
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top