Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If MsgBox("unload me?", vbYesNo) = vbNo Then Cancel = True End If End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu Then Cancel = MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo End IfEnd SubORPrivate Sub Form_Unload(Cancel As Integer) If MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo Then Cancel = 1 End If End Sub
Private Sub Form_Unload(Cancel As Integer) If MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo Then Cancel = 1 End If End Sub
If MsgBox("unload me?", vbYesNo) = vbNo Then
Cancel = True
End If
End Sub
If UnloadMode = vbFormControlMenu Then
Cancel = MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo
End IfEnd SubORPrivate Sub Form_Unload(Cancel As Integer)
If MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo Then
Cancel = 1
End If
End Sub
If MsgBox("是否确认关闭窗体?", vbYesNo) = vbNo Then
Cancel = 1
End If
End Sub
当转换 Boolean 值为其他的数据类型时,False 成为 0,而 True 成为 -1