Hi Chris and Dave,
 
> Thanks a lot for your enlightening reply to my message.

You're welcome. :)


> As all my programs up to this point have mainly been
> single form programs without a sub main I am surprised
> that I haven't had more problems up until now.
> 
> This is the code I am using when a user exits the
> program (single form program without a sub main): 
> 
>       unload me
>       end

Aaaaaaaaaagggggggggghhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!!!

NEVER USE END!!!

END is the one cardinal sin of VB. You can get away with other stuff
- like not using option explicit, but END is like turning off your
program with dynamite. Pieces of it are left over and God knows what
happened to your data (did you properly close connections and write
out your data before so blindly nuking your app?), your memory (any
objects still in memory STAY THERE eating it up until the system is
rebooted), and your yahoogroups (hasn't this guy read Hardcore VB?).

If you have not done so yet, read Hardcore VB.
  http://vb.mvps.org/hardcore/
It's a free read now and the files it uses are in our very own files
area. IMO, the best aspect of Hardcode VB is that it discusses the
use and and control of memory within your application. And how NOT
to [EMAIL PROTECTED] it up.

Don't EVER use END again!


> The program seems to unload ok but I found about a dozen
> explorer.exe in the task manager later after I noticed I
> couldn't click on shortcuts and what-not on the desktop.
> I don't know if this is related or not.

It is, and it's just one of literally hundreds of ways poor memory
management in your applications can screw up your users' computers.


> Is the best solution to implement a sub main and then
> unload the form, the set the form = nothing, then end
> (since the sub main won't have a form)?

Again, you NEVER USE END!!!

The ONLY solution is to reduce your object reference count to zero.
This will SAFELY terminate your objects without vaporizing them in a
haze of disaster.

Dig through your ENTIRE PROJECT and find every single object
variable, every single object that INTERNALLY references another
object (like an ADO DATA object or an imageview control) and turn
off their connections, disinvoke their references or do whatever
that particular object requires to shut it down.

THEN use:
  Unload frmMain
  Set frmMain = Nothing

Your application /will/ shut down without poisoning any cuddly
animals or beating defenseless children with a cane. Now, I may be
exaggerating a /little/ bit here, but that's what seeing END makes
me feel like.

Regards,

Shawn K. Hall
http://12PointDesign.com/
http://ReliableAnswers.com/

'// ========================================================
    Did you expect mere *proof* to sway my opinion?





'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to