hello,
unload me is not sufficent for what I am doing, I really need to replicate the action caused when the user clicks the close "X" at the top right of the form,
is it possible to do this programaticly?
thanks.
Printable View
hello,
unload me is not sufficent for what I am doing, I really need to replicate the action caused when the user clicks the close "X" at the top right of the form,
is it possible to do this programaticly?
thanks.
what does unload me do then?
well just ulonads the current app, also i i use unload frm1, unload frm2 etc i dont get the desired effect.
End will immediately pull the plug on your program.
But it is not a very good way.
You can use Unload for any form, not just the one that is calling it.
End not supported by dll is the error i get, presumably cause its not an exe.?
What effect do you want to replicate??
This won't close the form:
Is this what you're after? Also, End works also in the IDE.VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = 1 End Sub
thanks, but all i am trying to do is programaticly make the app beleive that the user has clicked the close cross.
"Unload Me" will do it. It will fire the Query_Unload event:
VB Code:
Option Explicit Private Sub Command1_Click() Unload Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormCode Then MsgBox "Form was closed through the code.", vbInformation End If End Sub
thanks
Here are some other constants:
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Select Case UnloadMode Case vbFormControlMenu MsgBox "Close command from Control menu or X button." Case vbFormCode MsgBox "Unload statement from code." Case vbAppWindows MsgBox "Windows session ending." Case vbAppTaskManager MsgBox "Task Manager close." Case vbFormMDIForm MsgBox "MDI parent is closing." Case vbFormOwner MsgBox "Owner is closing." End Select End Sub