MDI Child Window References being Set to Nothing
I have a question that should be easy for a VB .NET guru:
Fact: VB .NET supports creating MDI apps with menu merging etc. Instructions
are in the VS .Net Beta 2 Help.
When creating child windows is it important to write code that stores references
to them, or will it be OK to simply be OK let the MDI plumbing, maintain
references to them (i.e. the mechanism behind the MDI Window list)?
Explanation (if question not clear):
Why I worry about this is: (I have an MFC Doc/View perspective)
If I don't maintain an array of references to the child windows, I worry
that Garbage Collection will claim them. (so far it hasn't happened)
Yet, if I do maintain my own array of references, I find that some of them
are eventually set to Nothing if I force GC (even though I have not closed
the child windows). For example, I might have 10 child windows up but have
only 5 valid references in my array of references. If it turns out that
the MDI plumbing is maintaining the references, and I can't, I'll need to
figure out how to access this list of child window references.
Thanks, Hope I have not confessed to complete ignorance.
Re: MDI Child Window References being Set to Nothing
We like complete ignorance, it makes for easy questions (now, that was a
joke, if I need a smiley, you need another cup of coffee <g>)
The MDI parent keeps a reference to your child and you can access it through
that. Similarly the MDI child knows its parent. You do not generally need
your own list, although if you maintain your own list, nothing in the .Net
infrastructure will remove items from your list. If you do not find a simple
programming bug on your part doing that and can reproduce it, please insure
that it gets reported as a bug.
Non-MDI apps often need to maintain a list as the old VB Forms collection is
You can forget garbage collection, as it will only take out the trash on
items that you could not get to if you tried (completely inaccessible
Reply in the newsgroup so everyone can benefit
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center