Close button

mainman
09-08-2003, 11:15 PM
How do you change the behaviour of the close buttons?

I want to bring up "Do you want to save changes to file?" dialog box with the yes, no & cancel options. If yes has been selected, then there will be data printed to a particular file and form unloaded.

BlueDragon
09-08-2003, 11:17 PM
What do you want them to do? Why is the more important question?

mainman
09-08-2003, 11:22 PM
What do you want them to do? Why is the more important question?

I want to bring up "Do you want to save changes to file?" dialog box with the yes, no & cancel options. If yes has been selected, then there will be data printed to a particular file and form unloaded.

DirectAllX
09-08-2003, 11:25 PM
i understand you want to decide if the form unloads or not, ok, for this you have to code the Form_QueryUnload event
then you take the returned values from the MsgBox and if "Cancel" is pressed then set the Cancel parameter to any number different form 0 and it won't close your application

mainman
09-08-2003, 11:40 PM
i understand you want to decide if the form unloads or not, ok, for this you have to code the Form_QueryUnload event
then you take the returned values from the MsgBox and if "Cancel" is pressed then set the Cancel parameter to any number different form 0 and it won't close your application

Can you explain the parameters for QueryUnload

BlueDragon
09-09-2003, 12:16 AM
different possibilities ase something to the extent of:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
msgbox "Save?", vbYesNoCancel, "Save?"
If vbYes Then
'Do something
ElseIf vbNo then
'Do something else
ElseIf vbCancel then
'Something else yet again
End If
End Sub

DirectAllX
09-09-2003, 07:38 PM
the parameters (as blue dragon posted early) are Cancel and UnloadMode, cancel tell whether the application closes or not, and UnloadMode tells you the mode that the application is closing by.

it maybe by closing it form the toolbar, or by the "x" button on the title bar, etc. You'll have to look out in MSDN yourself

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum