opening a window form from another form programmatically

后端 未结 6 1346
一整个雨季
一整个雨季 2021-01-01 12:03

I am making a Windows Forms application. I have a form. I want to open a new form at run time from the original form on a button click. And then close this

6条回答
  •  耶瑟儿~
    2021-01-01 12:17

    To open from with button click please add the following code in the button event handler

    var m = new Form1();
    m.Show();
    

    Here Form1 is the name of the form which you want to open.

    Also to close the current form, you may use

    this.close();
    

提交回复
热议问题