Solved

Open/close forms in winforms c#

Posted on 2008-10-21
2
2,922 Views
Last Modified: 2013-12-17
Hi I am new to winforms programming most experience is web forms.

How Do I open another form from a button and the close the current form with a button?

So I have
    private void btnStreets_Click(object sender, EventArgs e)
    {
         Code to open or close a form here?

    }
0
Comment
Question by:charlesbaldo
2 Comments
 
LVL 5

Accepted Solution

by:
jfmador earned 500 total points
ID: 22772828
to close you simple need to call Close(); or this.Close();

to open a new one name frmTest1

frmTest1 frm = new frmTest1();
frm.Show();  

or

frm.ShowDialog(); to open it as Modal (you cannot acces other windows of this application since this form is close)
0
 

Author Closing Comment

by:charlesbaldo
ID: 31508578
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

20 Experts available now in Live!

Get 1:1 Help Now