|
-
Oct 7th, 2000, 06:16 PM
#1
Thread Starter
New Member
Hi,
How do I close my VB programs the right way?
When you use the end statement or the set ...= nothing I alsways see that the program is still in the memory.
This is done by Ctrl+Alt+Del.
Does somebody nows the answer.
Thanks...
-
Oct 7th, 2000, 06:21 PM
#2
Addicted Member
Unload Me
I think the proper command is: Unload Me
-
Oct 7th, 2000, 06:35 PM
#3
Actually the best way to completely close the program is to put End in the form unload
-
Oct 7th, 2000, 09:35 PM
#4
Hyperactive Member
For closing your programs try this:
<code>
'use this in your unload event
Dim Form As Form
For Each Form In Forms
Unload Form
Set Form = Nothing
Next Form
</code>
-
Oct 8th, 2000, 05:47 AM
#5
Fanatic Member
There are many different ways and every one is allowed their own opinion, i tend to use unload me because i have used end before and when i have a lot of forms is still leaves some active and the program doesn't fully close
so i would use
Unload me
Merlin ?
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Oct 8th, 2000, 10:34 AM
#6
Set Form = Nothing - Clears up any resources a form is using.
Unload Me - Unloads a form or control from memory.
End - Terminates execution. Never required by itself but may be placed anywhere in a procedure to close files opened with the Open statement and to clear variables.
Code:
Public Sub UnloadAllForms()
Dim Frm As Form
For Each Frm In Forms
Unload Frm
Set Frm = Nothing
Next Frm
End
End Sub
'Usage:
Call UnloadAllForms
I usually use all of them. End is not usually good by itself, nor is setting the form to nothing. Unload Me will work by itself well. But for less confusion and fustration, include all of them .
-
Oct 8th, 2000, 10:50 AM
#7
If you have a VB Module Prog, the proper way to end is:
Exit Sub
For a console program:
FreeConsole <API>
But if it's too many nested procedures, consider using
End
because ELSE it gets complicated.
-
Oct 8th, 2000, 10:58 AM
#8
Originally posted by Escaflowne
If you have a VB Module Prog, the proper way to end is:
Exit Sub
For a console program:
FreeConsole <API>
But if it's too many nested procedures, consider using
End
because ELSE it gets complicated.
If you have a VB Module Prog, the proper way to end is:
Exit Sub
Exit Sub - Immediately exits the Sub procedure in which it appears. Execution continues with the statement following the statement that called the Sub.
It does not End the program. And, from VB itself:
End - Terminates execution. Never required by itself but may be placed anywhere in a procedure to close files opened with the Open statement and to clear variables.
-
Oct 8th, 2000, 06:07 PM
#9
I agree with Tomexx on this one. However, remember to name your variables properly. Change Form to something else as it is already in use by VB.
-
Oct 8th, 2000, 09:02 PM
#10
Just a thought
Finished reading up on this...had a project which even when closed didn't release all resources
= nothing.......is spot on
But...........
They claim the me suffix to unload shouldn't be used, rather the actual form name should be used. Any one else have an opinion on this???????
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
|