can anyone here plz help me with my porblem..

im using VB6, i want to display a message whenever the user will close the window..]
can anyone teach me how to code it..

Hi, Try to Write MessageBox Coding in Form_QueryUnload event or Form_Unload Event. This is will show the Message whenever user close the Window

Private Sub Form_Unload(Cancel As Integer)
Dim msg
msg = "Do you want to Exit? "
reply = MsgBox(msg, vbExclamation + vbYesNo)
Select Case reply
Case vbNo
Cancel = -1
Case vbYes
End
End Select
End Sub

Private Sub Form_Unload(Cancel As Integer)
     Dim msg

     msg = "Do you want to Exit? "
     reply = MsgBox(msg, vbExclamation + vbYesNo)

     Select Case reply
          Case vbNo
                   Cancel = -1
          Case vbYes
                   End
          End Select
End Sub

Make it short...

Private Sub Form_Unload(Cancel As Integer)
     If MsgBox("Do you want to exit?", vbQuestion + vbYesNo) = vbNo Then
               Cancel = -1
     End If
End Sub
This question has already been answered. Start a new discussion instead.