VB中窗体关闭事件

2024-12-21 23:24:15
推荐回答(2个)
回答1:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

If MsgBox("你真的想退出吗? ", vbYesNo + vbDefaultButton1, "退出提示 ") = vbYes Then
End
Else
Cancel = True
End If

End Sub

回答2:

Dim a As Integer
a = MsgBox("你确认退出?", vbYesNo, "标题")
If a = 6 Then form1.close