On Mar 19, 2007, at 20:47 UTC, Keith DeLong wrote:

> Say I have 'dim w as new Window2' in the action event of a push
> button in window1. When I run the project and push the button,
> Window2 opens as expected. However, Window1 continues to exist after
> the completion of the method. Normally I would expect that as the
> local variable w goes out of scope at the end of the method (and
> lacking any other references) Window2 would cease to exist as well.
> Why not?

Because windows are special.  There is a global list of them, which you
can access via the WindowCount and Window(index) global methods. 
Whenever a window is created, it's added to this list; and when a
window is closed, it's removed from this list.  Thus, it doesn't matter
if you explicitly keep a reference to it or not; it's sticking around
until it's closed regardless, thanks to its reference in this global
window list.

In the same way, you don't need to keep a reference to a control,
because the window that's on has a reference to it internally.  Nor do
you need to keep a reference to a Thread that's running; there's a
global list of them too.  There are a couple of other places like this
in the framework as well, but they're all pretty sensible and amount to
objects not going away while they're clearly still in use.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to