question in c#

[size=3]hello everyone,
i am new here and i am also a new programmer and i am learning c#..i am using visual studio 2008 and started to build some very simple windows form apllication and now i am facing a problem.
how can i open a new form to replace the old form in a way such that when i close the second form ..all of the application gets terminated..something like the installation wizard of a program or a game..when you hit the next button the window form changes completely and whenver i press the (x)button on top right the installation wizard terminates completelly..i hope someone helps me as i really need to learn that so i can keep going

i hope i can find the help i need here..thanks all in advance[/size]


  • Hello to you too.

    Wherever you want to close the application you can add code like: application.exit();

    Now if you want to do this by closing a specific form you have to add in form's close event [application.exit();].

    About the old and new form : All forms are objects.When you create a project visual studio creates a form for you. Now if you want to make another and use it as "main" on your application you have to change the code in program.cs .

    In the Program.cs class there would be Main function something like below

    static void Main()
    Application.Run(new Form1());

    Change the Application.Run(new Form1());


    Application.Run(new Form2());

    This should work.
    If you need any example in code just let me know.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion