我知道这个问题是一个老问题,你现在可能已经弄清楚了,但我想我会添加一个答案以供将来参考。它们都有Forms
一个FormClosing和FormClosed事件,您可以在创建表单时附加一个处理程序。这是我想说的一个简单的例子。
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
If MsgBox("Open Report?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Dim frm2 As Form2 = New Form2
AddHandler frm2.FormClosed, AddressOf ReportClosing
frm2.Show(Me)
Else
Me.Show()
'Do your work for printing form here
End If
End Sub
Private Sub ReportClosing(sender As Object, e As FormClosedEventArgs)
'Remove handler to prevent memory leaks
RemoveHandler DirectCast(sender, Form2).FormClosed, AddressOf ReportClosing
Me.Show()
End Sub
End Class