简体   繁体   English

如何关闭MDI Child表单C#

[英]How to close MDI Child form C#

How do you close a MDI Child form within that child MDI form using a RETURN button which will bring me back to the Parent Form? 如何使用RETURN按钮关闭子MDI表单中的MDI子表单,这将使我回到父表单? So far i have used the code: 到目前为止,我已经使用了代码:

if (ActiveMdiChild != null)                 
            ActiveMdiChild.Close(); 

But this doesn't work. 但这不起作用。 I have tried numerous methods but nothing has worked so far Any help is much appreciated!! 我尝试了很多方法但到目前为止没有任何工作任何帮助非常感谢!

why not use: 为什么不使用:

foreach (Form c in this.MdiChildren)
{
   c.Close();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM