Hoping to clarify a few things, I am seeking advice rather than a solution.
I have produced an application for a Windows CE4 device and have some queries regarding Windows forms and some correct/incorrect assumptions I may have.
1) What is the "best" way (in terms of performance) of closing and opening a new form? I have a menu system, clicking on an option opens a new form. At present I am achieving this with:
dim x as new NameOFForm
On close, I also run a routine which sets all objects to nothing. Should I be disposing of the form as well (as I understand it, calling close also calls dispose)?
When manually calling dispose(), on some occassions, I get an "Object Disposed exception" which presumably means I havent set everything to nothing?
This method also seems to (overtime) consume some memory. Running a thread watch also shows that the old forms still exist though they may be set to nothing - are they consuming resources or just empty structures awaiting GC?
2) Is it bad practice to call dispose on an object/form? I've heard conflicting reports on whether this is a good idea. Should I leave it upto garbage collection?
3) Sometimes when closing a form (very occassionally) I receive a native exception error - any ideas (in general) what might cause a native exception? I understand this may be as a result of using unmanaged code (GetPowerStatusEX) or is to do with form disposal?
4) If I close/dispose of a form, since child controls exist on this form - are they disposed of automatically as well or do I manually have to set them all to nothing? I believe they still exist, since closing a form causes an object disposed exception when a timer on the form ticks.
Thanks for any help.