Close Parent Window when Opening Child Window

After executing ShowDialog(), the following code will not be executed before closing the child window.

public partial class Parent : System.Windows.Forms.Form
{
    public Parent()
    {
        InitializeComponent();
    }
    private void toChild_Click(object sender, EventArgs e)
    {
        Child child = new Child();
        this.Hide();
        child.ShowDialog();
        this.Close();
    }
}
posted @ 2018-11-09 17:27  Kyle0418  阅读(162)  评论(5编辑  收藏  举报