I have a MDI Parent form...

Now .. for the close button ( X ) on top right i have the code

vb Code:
  1. Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  2.  
  3.    
  4.   Dim vbResponse As VbMsgBoxResult
  5.   vbResponse = MsgBox("Are You Sure You want to exit the Program?", vbYesNo, " Exit Application")
  6.   Select Case vbResponse
  7.   Case vbYes
  8.   Unload Me
  9.   Case vbNo
  10.   Cancel = -1
  11.   End Select
  12.      
  13. End Sub

as suggested by some1..

and I have a EXIT coded in the menu.. the code is

vb Code:
  1. Private Sub mnuexit_Click()
  2.  
  3. msg = MsgBox("Are You Sure You want to exit the Program?", vbYesNo, " Exit Application")
  4.  
  5. If msg = vbYes Then
  6. Unload Me
  7. Else
  8. Exit Sub
  9. End If
  10.  
  11.  
  12. End Sub

Now the problem is.. that when i click on the close button.. its works fine..

But when I click on the the EXIT MENU.. then it 1st runs its msgbox.. then runs the CLOSE BUTTON code??? I dont know why.. so the msgbox pop ups twice on the EXIT MENU

Please help here.. I dont want the box to come twice asking again to exit or not..