vb.net下的窗体卸载事件不在使用Unload了,改用Closed,具体的写法如下:
Private Sub Form1_FormClosing(ByVal sender As Object,ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim isDataSavad As MsgBoxResult
isDataSavad = MsgBox("您确定要退出该系统吗?",vbYesNo + vbQuestion,"提示")
If isDataSavad = vbNo Then
e.Cancel = True
Else
e.Cancel = False
End If
End Sub
看似很简单,除了方法名变了其它的几乎没有变化...