質問編集履歴
2
使用フレームワークと統合開発環境を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
複数展開しているフォームの中から特定のNameを持つフォームを一気にClose処理を作成したいのですが、
|
4
4
|
下記のコードではOpenFormsで取得したコレクションの内容を変更してしまうのでエラーが起きてしまいました。
|
5
5
|
|
6
|
+
フレームワーク: .NET Framework 4.6
|
7
|
+
統合開発環境 : Visual Studio 2017 Express
|
8
|
+
|
6
9
|
```c#
|
7
10
|
|
8
11
|
foreach (Form frm in Application.OpenForms)
|
1
Hoge → FormHoge
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
foreach (Form frm in Application.OpenForms)
|
9
9
|
{
|
10
|
-
if(frm.Name.ToString() == "
|
10
|
+
if(frm.Name.ToString() == "FormHoge")
|
11
11
|
{
|
12
12
|
frm.Close();
|
13
13
|
}
|