且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

防止表格关闭?

更新时间:2023-12-02 09:51:34

Try setting Cancel = True in the Closing event to prevent the form from unloading.


Hi! I have the solution of this Problem

Use This Code :

Private Sub FrmMDI_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    Dim Flag As Integer
    Flag = (MsgBox("Are you sure you want to exit ? ", vbInformation + vbOKCancel, "Exit"))
    If Flag = 2 Then e.Cancel = 1
    End
End Sub



And Your Problem is Solved.
Thank you. :)