Skip to content

Open new form and closing the previous one

odelya glick

Asked Mar 5, 2006, 10:04 AM EST2 answers
Share
LinkedInX
Hi
I am opening a new form by:
ChooseLeve chl = new ChooseLevel();
chl.owner = this;
chl.close;

i want that when the user clicks on button1 in chl (ChooseLevel), the preiouse form will be closed,
how do i do it?

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    I'm not expert, but could you do it this way:

    ChooseLeve chl = new ChooseLevel();
    chl.showdialog();
    this.hide();

    0
  • 0


    have you tried

    private void ButtonClick()
    {
    Application.Run(new Form2());
    this.Close();
    }

    Form2 will have no owner, so when Form1 closes it wont cleanup Form2. Secondly because the application still has something to process (Form2) it will continue happily..

    0