Private Sub Form_Unload(Cancel As Integer)
i = MsgBox("确定要退出系统吗?", 33, "提示")
If i = 1 Then
    Call Dellog
    End
Else
    Exit Sub      
End If
End Sub不论我按确定还是取消,都是退出程序,怎么解决呢?

解决方案 »

  1.   

    Private Sub Form_Unload(Cancel As Integer) 
    i = MsgBox("确定要退出系统吗?", 33, "提示") 
    If i = 1 Then 
        Call Dellog 
        End 
    Else 
        Cancle=1    
    End If 
    End Sub
      

  2.   


    Option Explicit
    Dim i As Long
    Private Sub Form_Unload(Cancel As Integer)
    i = MsgBox("确定要退出系统吗?", 33, "提示")
    If i = 1 Then
        Call Dell
        End
    Else
       Cancel = 1 '上一个写错了,.
    End If
    End Sub
      

  3.   

    If i = vbyes Then 
        Call Dellog 
        End 
    Else 
        cancel = true     '要加这句,才是取消退出过程。
        Exit Sub      
    End If 
      

  4.   

    If MsgBox("确定退出系统", vbOKCancel) = vbOK Then
        End
    Else
        Cancel = 1
    End If