|
-
Mar 11th, 2001, 05:14 PM
#1
Thread Starter
Hyperactive Member
[resolved]
I need help desperately!
My program, cant unload properly now.
When running under VB, after clicking exit (Unload Me) or the big X, the form is gone, but the VB still in 'run' mode.
In order for my main Form to terminate properly, I gotta click on my About button(frmAbout.show vbModal,Me) [which doesnt run any specific things in the Form_Load(frmAbout) section.] then close the about and then can exit the main form properly.
Anyone ever experience this?? What's is wrong?
It was OK earlier, and I cant trace back the problem now 
Harddisk
Last edited by Harddisk; Oct 11th, 2005 at 04:53 AM.
-
Mar 11th, 2001, 05:18 PM
#2
Frenzied Member
Check if a form calls frmAbout.Show vbModal at any other time in the program. I had a similar problem once. You can find it around here somewhere.
retired member. Thanks for everything 
-
Mar 11th, 2001, 05:19 PM
#3
do you load any forms somewhere? Like, do you Load frmAbout at some point, and then when you click on the about button, all it has to do is show?
try this in the Form_UnLoad event :
Code:
For Each Form In Forms
Set Form = Nothing
Next
see if that helps...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 05:27 PM
#4
Lively Member
there is just a little code to add :
Code:
Private Sub Form_UnLoad()
END
end sub
and this will terminate the program whatever is happening
All what you dream is codable - DevMaX
-
Mar 11th, 2001, 05:31 PM
#5
Thread Starter
Hyperactive Member
Originally posted by markman
Check if a form calls frmAbout.Show vbModal at any other time in the program. I had a similar problem once. You can find it around here somewhere.
Nope. The only time frmAbout.Show vbModal, Me is executed, it's on the cmdAbout_Click event. Dont have any other opened forms as well.
There are a total of 3 forms
Code:
frmMain -- frmFile (consists of Drive, Dir, File dialogs)
\
frmAbout (frmMain is able to terminate after clicking/opening this)
The frmMain form can be terminated properly only if I ever click on the About button to call out frmAbout. As for frmFile, it does nothing, the frmMain still stuck there.
Thanks
Harddisk
PS: I did a search on .show on my project folder, it only occurs on the frmMain form file. When I do another search in the file(frmMain) content, there are 2 occurances, which is frmAbout.Show, and frmFile.Show.
Last edited by Harddisk; Mar 11th, 2001 at 05:41 PM.
-
Mar 11th, 2001, 05:40 PM
#6
Thread Starter
Hyperactive Member
Originally posted by devmax
there is just a little code to add :
Code:
Private Sub Form_UnLoad()
END
end sub
and this will terminate the program whatever is happening
Thanks, this one works like charm, but I still wondering why doesnt the Unload Me/frmMain works, like it used to earlier.
<sigh>
Harddisk
-
Mar 11th, 2001, 11:09 PM
#7
I'm sorry to disagree with devmax, but you should never used End if you want to exit a program gracefully. While end will cause the program to terminate, it often does not give VB enough time do it's housekeeping and what this means is that you may wind up with memory leaks. Rather than using End, just make sure that all forms are unloaded when you want to end. This can be easily accomplished with the following code
Code:
'***************************************************************************
'Purpose: Unload all forms when the user is ending execution via the
' FormControlMenu.
'Outputs: None
'***************************************************************************
Dim nNdx As Integer
'When done forward, this sometimes gives subscript out of range errors
For nNdx = Forms.Count - 1 To 0 Step -1
Unload Forms(nNdx)
Next
End Sub
-
Mar 11th, 2001, 11:14 PM
#8
PowerPoster
I've read in many articles that using "End", after all other forms have been released from memory, by setting each form to nothing, only benefits in the so called "House Keeping" at the end of a prog. Just my .02 cents...
-
Mar 11th, 2001, 11:16 PM
#9
Originally posted by Lethal
I've read in many articles that using "End", after all other forms have been released from memory, by setting each form to nothing, only benefits in the so called "House Keeping" at the end of a prog. Just my .02 cents...
correct Lethal, but using End by itself is not a very good idea...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 11:23 PM
#10
PowerPoster
Totally agree, just want to though in my thoughts, to use it AFTER all memory is released...Glad somebody agrees...
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
|