-
December 2nd, 2001, 08:44 AM
#1
My Applications don't close
Hello Everyone...
Partners I developed an application , but I want to close it, not close totally.
What can to do?
How I can know what control is still open?
Thanks a lot..
joseluisbz@bigfoot.com
Please Response to:joseluisbz@bigfoot.com
http://www.bigfoot.com/~joseluisbz
-
December 2nd, 2001, 11:40 PM
#2
Re: My Applications don't close
You need to remove all references to objects that may have been opened.
One way to do this, is when you have finished with an object, or when you want to close the app, add the following code for the object(s).
if not(obj is nothing) then _
set obj = nothing
This code with de-reference the object. (remember, an app will not close while there is an object still active - of cause it is a bit more complicated than this, but if you are a beginner than this rule keeps you out of trouble.)
-
December 3rd, 2001, 02:28 AM
#3
Re: My Applications don't close
In addition to reply from uni, you shouls also use END statement to shut the application. It is a common practice but I thought I should tell you.
Santulan
-
December 3rd, 2001, 03:10 AM
#4
Re: My Applications don't close
You SHOULD NOT use "End" because it will close the program without releasing references etc.. i.e it doesnot close 'gracefully'
First close all pointers to global objects etc. with set obj = nothing command as shown in other post and then
Unload all the forms with some code like
for i = 0 to forms.Count
unload forms(i)
next i
RK
-
December 3rd, 2001, 06:51 AM
#5
Re: Ravi si right
Never use End.
It is not a "common practice" but a "common mistake" (take this the soft way: you're in good company...but from now on, banish the "end" keyword from your vocabolary).
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
December 5th, 2001, 05:54 PM
#6
Re: My Applications don't close
Hello:
Never I used this code...
Please send me a snippet of code showing how to I use it in real components or Database.
Thanks...
joseluisbz@bigfoot.com
Please Response to:joseluisbz@bigfoot.com
http://www.bigfoot.com/~joseluisbz
-
December 5th, 2001, 06:21 PM
#7
Re: My Applications don't close
'I hope the following code helps. I am using
'an example that loads a file into
'word (using the
'word 8 or 9 object library).
Private objwordapp as word.application
Private objworddoc as word.document
Private sub try()
'The following code fragment will only attempt
'to initialize the word objects if they have
'not already be initialized. This
'reduces processing time if the procedure
'is being resused.
'********************************
If objwordapp is nothing Then _
set objwordapp as new word.application
If objworddoc is nothing Then _
set objworddoc as new word.document
'********************************
'Load the document into the word application
set objworddoc = objwordapp.documents.open(pathname)
'When you have finished using the objects
'remove all references. (In this
'case I am using word objects which also
'require a close and quit respectively).
'By setting the objects to nothing, the
'objects references are removed. If this is
'not done, an application can
'experience significant decreases in
'performance, and in some cases fatal
'memory errors. Remember VB is not like Java.
'It does not have its own garbage collector,
'a certain amount of memory handling is expected.
'********************************
If (not objwordapp is nothing) Then
objword.Close
set objwordapp = nothing
End If
If (not objworddoc is nothing) Then
objwordapp.Quit
set objworddoc = nothing
End If
'********************************
End sub
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
|