Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unload kills app 2

Status
Not open for further replies.

Alabaster

Programmer
Aug 11, 2001
44
CA
Ok, I'll admit first that VB6 is not my strongest lang. but this seems to simple a problem for me to grasp.

I want a form to open for login and then load the main form but when I try to unload/close my login form, the app ends.
- code -
If {Login test fails} Then
msgbox bad login
Else
Call SetUserID(txtName.Text) ' Sets my global for username
Load frmMain
Unload frmLogin

End If
Am I missing the obvious here? :-(
Thanks for the help
Peter
 
Thanks for the thought but this is triggered from a button click.

Happy Easter Everyone :)

Peter
 
Use Show frmMain instead of Load.

Load only loads the form, it doesn't show it - Show loads it if it isn't already loaded and shows it as well


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks Johnwm,
I will use that in the future, but how does this solve my problem of my App terminating when I unload frmLogin. I don't want ot just hide it for several reasons, including a logoff/logon option that I have on other forms.

Thanks
Peter
 
Hi Alabaster,

I think the problem here is that you are loading your program from this form.

Try loading the program from a Sub Main in a code module or from the main form, but rather than showing the main form first, show the login form.

Also make sure that you never use END anywhere in your program.

Craig, mailto:sander@cogeco.ca

In the computer industry, there are three kinds of lies:
lies, damn lies, and benchmarks.
 
Your program probably isn't ending. What is happening is you are unloading the Login form but not displaying the main form. If you check in Task Manager you should see the program is actually still running.

johnwm's suggestion should solve your problem.
 
CraigSander - Thanks for the sugestion, I guess it's the access programer in me that keeps forgeting about modules.

jbradley - I know that the prgram is terminating, because I use taskinfo to monitor my treads and make sure that I dont leave anything necessary open in memory.

I will make the necessary mods tonite and see if that resolves the problems, thanks guys.

Peter
 
Peter,

What is this taskinfo you mentioned... I am having issues with a certain collegaue not writting clean code, and I need to prove to him that he is leaving threads open, and therefore creating memory leaks in the overall program.

Thanks,


Craig, mailto:sander@cogeco.ca

In the computer industry, there are three kinds of lies:
lies, damn lies, and benchmarks.
 
Craig,
Check out
The product is called Taskinfo2003.

Its an awesome program, I've used it to manage my programming as well as discovering and terminating active viruses on client computers.

Peter
 
OK...
Maybe I'm being a little thick here but this show/hide/load crap is starting to bother me.
My application is starting to be less complicated than the loading and login process.
I have a splash form that tests for a couple of registry values and then decides if form "A" needs to be loaded or form "B".
If form "A" is loaded it sets the necessary registry values and loads form "B"
Form "B" is my login form, plain and simple, user name and password check against an access db. From here I want to "open" my main form which is supposed to be hidden as it is a system tray object anyway. I also want ot "get rid of" my login form. I may or may not require the login form again before closing the application.

If I choose to "show" my main form I now have an onload hide issue to deal with. Also by "hiding" my login form I now have to reset the login fields and failed login counter before reusing it.

There has to be something "more eliquent" then show/hide, but the load / unload is definitly killing my app no matter where I call it from.

Please help me keep from going gray.[sadeyes]

Peter
 
Heed last post carefully! :)
I was being very thick, very very thick!

This should teach me for not reading all the code I copy from tek-tips and PSC.

Here has been the source of my agrivations...

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End 'I am not unloading i am ending the program
End Sub

Had I just payed close enough attention I could have saved myself a few gray hairs.

Thanks to all those that tried to help, I guess there is no fix for lazyness.[smarty]

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top