Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: How close the application safely


Message #1 by Zulfazli <Zulfazli@l...> on Mon, 23 Sep 2002 09:46:17 +0700
The End is a very dangerous statement. I just wish Miscrosoft did not
documented it (as it did with ObjPtr and cousins) because
it terminates you app without releasing any resources
The best way to end gracefully is to add an unload loop method in
a bas module (that is accessable from anybody), something like:

Public Sub EndApp()
    Dim frx As Form
    For Each frx In Forms
        Unload frx
    Next
End Sub

And substitute your End statement with the EndApp call.

Marco

> Hi gurus,

If i have an mdi app wich have many forms open. And in one module, if i 
have
an error, i want to end the app, how do i do to close the app safely. Can i
use just the End statement, without worrying about the open forms ? In my

  Return to Index