0
- 假設有多於3個子表單作爲
Can_ListCandidate
和其他一些表單打開。每當我點擊一個 按鈕,所有Can_ListCandidate
表單將被關閉。
我試過下面的代碼,但它沒有工作。如何使用C關閉所有定義的子表單#
Can_ListCandidate frm = new Can_ListCandidate();
foreach (Form f in this.MdiChildren)
{
if (f == frm)
{
frm.Dispose();
return;
}
}
或
Can_ListCandidate frm = new Can_ListCandidate();
foreach (Form f in this.MdiChildren)
{
if (f is Can_ListCandidate)
{
frm.Dispose();
return;
}
}
''==是指涉平等。我想你想做'f是Can_ListCandidate'。 – 2014-10-31 14:49:33
這可能有助於發佈一些更多的代碼。 – 2014-10-31 16:15:18