How to open a new form from another form

后端 未结 11 1689
太阳男子
太阳男子 2020-12-03 00:29

I have form which is opened using ShowDialog Method. In this form i have a Button called More. If we click on More it should open another form and it should close the curren

11条回答
  •  孤街浪徒
    2020-12-03 01:07

    private void Button1_Click(object sender, EventArgs e)
    {
        NewForm newForm = new NewForm();    //Create the New Form Object
        this.Hide();    //Hide the Old Form
        newForm.ShowDialog();    //Show the New Form
        this.Close();    //Close the Old Form
    }
    

提交回复
热议问题