返回首页

您好

我要关闭子窗体的另一个子窗体时,请给我的代码,

我要询问顾客关闭目前的形式是不?如果他没事点击的形式应该关闭。

USIND的MdiParent

我完全有10名儿童形式,一种形式,如果打开另一个应该关闭。

回答

评论会员:OriginalGriff 时间:2012/02/04
在父窗体,FormClosing事件处理子窗体。火灾时,您可以询问用户,关闭的第二个孩子的形式,如果你需要 - 与secondChildFormInstance.Close()方法
评论会员:游客 时间:2012/02/04
。"米卡Wendelius:单程要做到这一点,您关闭并打开子窗体的MdiParent。当一种新的形式将被打开,你可以检查imgsrc=],如果有任何儿童,如果有必要,并关闭他们的阿伦・库马尔金水
可能是这个代码将帮助你

//Get all  child forms in MDI container

            Form[] ChildFormArray = this.MdiParent.MdiChildren;

 

            // Loop through all child form.

            for (int iCount = 0; iCount < ChildFormArray.Count(); iCount++)

            {

               if( MessageBox.Show("Do you want to close this form " +ChildFormArray[iCount].Text, "", MessageBoxButtons.YesNo )==DialogResult.Yes)

                {

                   //Close child form

                    ChildFormArray[iCount].Close();

                }

               

            }
评论会员:koolprasad2003 时间:2012/02/04
检查{A1}]