Windows appication question

Posted on 2006-05-02
Last Modified: 2010-04-16
I have a windows form (C# )and i have a button in there and when clicked it should close the current form and display another form (form2). How do i do that?
Question by:jyotishb
    LVL 10

    Expert Comment

    You could do something like this:

            private void button_Click(object sender, EventArgs e)
                Form2 frm = new Form2();

    Author Comment

    I got it..

    i did something like this

    private Form3 fm= new Form3();

     private void button_Click(object sender, EventArgs e)
    LVL 10

    Accepted Solution

    If you use showdialog, you can also add your initial form as the owner of the second. Ex. frm2.showdialog(frm1)

    You can pass objects between forms this way.

    Glad to hear you got things working.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now