Hi Rob, Everything helps! Thanks. I must admit though that I've never tried showing all my forms modally, and don't think I ever would! I have too many instances of needing to show multiple forms, especially showing things like setup forms, which need to be modal but able to be shown at any time. I know it's possible to show two modal forms at the same time but it's such a pain and it's mostly a design fault.
I don't see how this can help with my specific questions though - how does unloading a form from code that's running on that form exit the application(?) (why doesn't the code after the unload statement, even if its only an End Sub, reload the form?), and is it possible to correctly terminate an application from a sub in a code module which is called from a form? Regards Ian ----- Original Message ----- From: crombierob To: [email protected] Sent: Sunday, February 27, 2005 7:31 PM Subject: [vbhelp] Re: Ending an Application 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 Sponsor ADVERTISEMENT ------------------------------------------------------------------------------ Yahoo! Groups Links a.. To visit your group on the web, go to: http://groups.yahoo.com/group/vbhelp/ b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] '// ======================================================= 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/
