MDIの親であるメインフォームがあります。
内部では、次のような2番目の(同じソリューション、異なるプロジェクト)フォームを開きました。
Dim f As New mynevproj.frm_list
With f
.MdiParent = Me
.Show()
End With
これらの新しいフォーム(frm_list)では、いくつかの例で別の新しいフォームを開きます。
Dim fa As New frm_art1
With fa
.StartPosition = FormStartPosition.Manual
.Location = New Point(Me.Location.X + 20 + (inst * 20), Me.Location.Y))
AddHandler .aClosed, AddressOf frm_artikl_Closed
.Show()
End With
何が起こるのですか?
frm_art1のいくつかのインスタンスを開いてから、frm_listを閉じると、frm_listを閉じるためにすべてのfrm_art1が閉じられると思います。
しかし、それは起こりません。
(X)をクリックしてfrm_listを閉じるたびに、frm_art1の1つのインスタンスが閉じ、最後にすべてのfrm_art1が閉じられると、frm_frm_listが閉じます。
frm_listを閉じると、frm_listで開いたすべてのフォームが閉じるようにする方法。
これは、MDI以外の環境でうまく機能します。
次に、frm_listのform_closeingでこれを追加してみます。
For Each frm As Form In My.Application.OpenForms
If frm.Name = "frm_art1" Then
frm.Close()
End If
Next
そして、これも機能しません!