Alex Rivera | Logout

c# open a new form then close the current form?

Asked 2011-04-05T07:45:38.067
114

For example, Assume that I'm in form 1 then I want:

  1. Open form 2( from a button in form 1)
  2. Close form 1
  3. Focus on form 2
Edit
Report

1 Answer

0
private void buttonNextForm(object sender, EventArgs e)
{
    NextForm nf = new NextForm();//Object of the form that you want to open
    this.hide();//Hide cirrent form.
    nf.ShowModel();//Display the next form window
    this.Close();//While closing the NextForm, control will come again and will close this form as well
}
answered 2013-03-19T08:24:59.573

Your Answer