我正在以父表单编写以下代码,一次只打开一个子表单,当我child form从parent form
public void OpenForm(Form toOpen)
{
foreach (Form child in MdiChildren)
child.Close();
toOpen.MdiParent = this;
toOpen.Show();
}
private void btnExam_Click(object sender, EventArgs e)
{
OpenForm(new ChooseExam(LoginName));
}
但是当我2nd child form从1st child form那个时候打开时,parent window这两个子表单同时出现,现在我如何在通过它first child form打开时关闭2nd child form,在第二个表单的后退按钮中,我如何才能看到第一个子表单
我在上面尝试了相同的代码使用这行代码的toOpen.MdiParent = this.ParentForm ;子表单,但我仍然可以看到两个子表单,我该怎么做?