在VB.NET
FormClosed
和FormClosing
事件之间有什么区别?
Private Sub frmTerminal_TCP_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
End Sub
Private Sub frmTerminal_TCP_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End Sub
答案 0 :(得分:10)
FormClosing
发生在FormClosed
之前。将FormClosing
想象为要求您在退出程序之前保存文档的对话框。它让您有机会取消窗口的终止。
FormClosed
。来自MS documentation:
FormClosed事件发生在用户关闭表单之后,或者由Close类或Application类的Exit方法关闭。若要防止表单关闭,请处理FormClosing事件并将传递给事件处理程序的CancelEventArgs的Cancel属性设置为true。