Winform Forms Closing and opening a new form

后端 未结 8 1230
时光说笑
时光说笑 2020-12-06 07:47
1. frmHome frm = new frmHome();
   frm.Show();
   this.Close();

I\'m opening HomeForm from LoginForm. In LoginForm

8条回答
  •  北海茫月
    2020-12-06 08:07

    Why don't you just stop calling application.exit in the form_closed event?

    I am not sure that you really need it anyway, and if you do then you can remove the x icon from the screen and give them a close button.

    Alternatively there is a CloseReason in the event args that will tell you if it is a user closing the form or code or something else.

提交回复
热议问题