展开全部
把一楼的改一下,就变成了关不了的窗口😄
Private Sub Form_Unload(Cancel As Integer)
myexit = MsgBox("看完才能退出哦", vbExclamation + vbYesNo + vbDefaultButton, "哼...")
Cancel = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
myexit = MsgBox("看完才能退出哦", vbExclamation + vbYesNo + vbDefaultButton, "哼...")
Cancel = True
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在关闭窗体的时候触发几个事件,可以在两个事件过程(sub)中来处理
首先是 Form_QueryUnload,其次是 Form_Unload,取其一即可
可以自己复制代码测试以下
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = MsgBox("您果真要退出?", vbYesNo, "来自:Form_QueryUnload") = vbNo
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = MsgBox("您果真要退出?", vbYesNo, "来自:Form_Unload") = vbNo
End Sub
首先是 Form_QueryUnload,其次是 Form_Unload,取其一即可
可以自己复制代码测试以下
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = MsgBox("您果真要退出?", vbYesNo, "来自:Form_QueryUnload") = vbNo
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = MsgBox("您果真要退出?", vbYesNo, "来自:Form_Unload") = vbNo
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看我的,给你优化一下:
Private Sub Form_Unload(Cancel As Integer)
myexit = MsgBox("您果真要退出?", vbExclamation + vbYesNo + vbDefaultButton2, "退出确认...")
If myexit = vbNo Then
Cancel = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
myexit = MsgBox("您果真要退出?", vbExclamation + vbYesNo + vbDefaultButton2, "退出确认...")
If myexit = vbNo Then
Cancel = True
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_Unload(Cancel As Integer)
Dim r As VbMsgBoxResult
r = MsgBox("是否真的关闭窗口?", vbOKCancel)
If r = vbOK Then
Cancel = -1
Else
Cancel = 0
End If
End Sub
Dim r As VbMsgBoxResult
r = MsgBox("是否真的关闭窗口?", vbOKCancel)
If r = vbOK Then
Cancel = -1
Else
Cancel = 0
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询