1)Form的Load事件:
打开窗体即可显示
2)Form的Closing事件:
关闭时显示。
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("您确定要关闭本系统吗?", MsgBoxStyle.OKCancel, Me.Text) = MsgBoxResult.OK Then
Me.DialogResult = DialogResult.Cancel
e.Cancel = False
Else
e.Cancel = True
End If
End Sub