|
-
Nov 11th, 2002, 08:35 AM
#1
Thread Starter
Frenzied Member
***INSTANTLY RESOLVED***Closing program (THANKS HACK!)
I have this code in the close command button that is supposed to close the program
VB Code:
Private Sub cmdCloseProgram_Click()
Unload me
Set frmItem=Nothing
Set frmOrder=Nothing
End Sub
When I use this button to close the program, it closes well & I cant see the program running in the Task Manager- Processes Tab but when I close the program by pressing [X] button on the upper right corner of the form, it keeps running in the back ground and I can see it thru Task Manager..Any Idea, how I can rectify this?
Last edited by mxnmx; Nov 11th, 2002 at 08:46 AM.
-
Nov 11th, 2002, 08:38 AM
#2
Move you close code to the Unload event of your main form. When you close the form via the X button, your code is not being processed.
If you run it from the unload event, no matter how the user closes the form, your code will run.
-
Nov 11th, 2002, 08:39 AM
#3
PowerPoster
Move the Nothing part to Query_Unload
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set frmItem = Nothing
Set frmOrder = Nothing
End Sub
-
Nov 11th, 2002, 08:40 AM
#4
Addicted Member
Private Sub cmdCloseProgram_Click()
Unload me
Set frmItem=Nothing
Set frmOrder=Nothing
'== = Thets you need ===
End
'==================
End Sub
P.S. Sorry for my poor English...
-
Nov 11th, 2002, 08:45 AM
#5
Thread Starter
Frenzied Member
-
Nov 11th, 2002, 08:47 AM
#6
PowerPoster
GameBit, if he closes his form through the "x" button at the top, your code will not be executed. Also, try to avoid "End" statements as far as possible.
-
Nov 11th, 2002, 08:53 AM
#7
Stuck in the 80s
Originally posted by GameBit
Private Sub cmdCloseProgram_Click()
Unload me
Set frmItem=Nothing
Set frmOrder=Nothing
'== = Thets you need ===
End
'==================
End Sub
Using 'End' leads down the path to the dark side. So don't ever use it. mkay?
-
Nov 11th, 2002, 05:48 PM
#8
Hyperactive Member
Maybe add the following code to the Exit App event:-
VB Code:
Dim f as Form
For each f in Forms
Unload f
Next
This will ensure each form is unloaded cleanly.
"I'm Brian and so is my Wife"
-
Nov 11th, 2002, 07:21 PM
#9
PowerPoster
Originally posted by The Hobo
Using 'End' leads down the path to the dark side. So don't ever use it. mkay?
I thought we declared it was ok to use End after u'd unloading and set the forms to nothing?
-
Nov 11th, 2002, 08:28 PM
#10
Hyperactive Member
VB Code:
Dim f as Form
For each [b]f in Forms[/b]
Unload f
Next
*lol*
We all get upset, but no need to take it out on the poor forms
-
Nov 11th, 2002, 09:07 PM
#11
Stuck in the 80s
Originally posted by Pc_Madness
I thought we declared it was ok to use End after u'd unloading and set the forms to nothing?
Who are you including in this 'we?' I never remember declaring anything of the sorts.
-
Nov 11th, 2002, 09:45 PM
#12
PowerPoster
Those threads we had in the past about this topic... I'll see if I can find them...
-
Nov 11th, 2002, 09:54 PM
#13
PowerPoster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|