How to prevent closing a form Using Closing Button Of a Vb Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ravi Dwivedi

    #1

    How to prevent closing a form Using Closing Button Of a Vb Form

    I am Software Engineer and Want to Enforce In Our Visual BAsic Project
  • nibir

    #2
    Private Sub Form_QueryUnloa d(Cancel As Integer, UnloadMode As Integer)
    If MsgBox("Do you want to close the form ?", vbYesNo + vbDefaultButton 2) = vbYes Then
    Cancel = 0
    Else
    Cancel = 1
    End If
    End Sub

    Comment

    Working...