‘主窗体的 Closing 事件代码
Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As ) Handles MyBase.Closing If MsgBox("您真的要退出系统吗?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "退出系统") = MsgBoxResult.Yes Then Application.Exit() Else e.Cancel = True End If End Sub