Hi Ian,

I don't know if this helps.
In every pgm that i have written, I always show forms VBModal.
The pgm always knows where it is.
I know where pgm execution will go to after a Form closes, as it
returns to the line following the line that opened it.
At that point I read any public variables (returning any choices etc
made in that Form). I then set the Form to Nothing.
I never have to have loops closing/etc Forms, as everything has always
been cleaned up.
It appears that I am the only one who does this (avoids chaos).
I, and my users, have never felt hamstrung by not being allowed to
have 50 Forms open at once.

Rregards,
Rob   


--- In [email protected], "Ian Brooke" <[EMAIL PROTECTED]> wrote:
> Hi All,
> I'm sorry to raise this issue again, it seems to come around every 6
months or so, but although I understand *how* it's done and *why* it
needs to be done this way, and I've done it correctly (I hope!)
hundreds of times, the more I think that I don't really understand why
it actually works.  I think that I've tended to accept that it does
work without really thinking about how it works.
> 
> I am of course talking about exiting/ending/closing call it what you
will, an application. I understand that the way to do it is to unload
all the forms, set any references to them and all loaded objects =
Nothing and finally exit.  However (and I'll give a really simple
example), assuming we start the app from Sub Main, that shows a form
that waits for a button to be clicked, and when that happens it
unloads the form and exits.  But how is that possible?  I know from
bitter experience of having a shutdown sub in a common module that
this doesn't work - if the sub is called from the form (which directly
or indirectly it must be), and that sub unloads the form, and even
sets it = nothing, then it must then exit back to the form and the
form is reloaded and the app doesn't end.  By that same mechanism, if
in the command button click module I put, Unload Me, Exit Sub, how
does that end the app?  The Exit Sub statement is part of the Form, in
order to execute, some reference to it (and therefore to the form)
must exist and so why does the app end?
> 
> Following on from that, is there really any way to correctly shut
down from a common routine in a module?  If there is then I can't find it!
> 
> Ian






'// =======================================================
    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