请教:关闭MDI窗口前关闭所有其子窗口的问题?
目的:关闭MDI窗口前关闭所有其子窗口
问题:会执行两次子窗口中的代码:((该代码在VB6中只执行一次)
MDI的closing代码
Dim frm As Form
For Each frm In Me.MdiChildren
frm.Close()
Next
If Me.MdiChildren.Length = 0 Then
If MsgBox("确定退出MDI窗口?", MsgBoxStyle.Question + MsgBoxStyle.OKCancel, "提示") = MsgBoxResult.Cancel Then e.Cancel = True
Else
e.Cancel = True
End If
子窗口closing代码
If MsgBox("确定退出MDI子窗口?", MsgBoxStyle.Question + MsgBoxStyle.OKCancel, "提示") = MsgBoxResult.Cancel Then e.Cancel = True