Questions regarding hidding vs closing forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a few questions regarding hidding vs closing forms. Is it bad
practice to close the current form when openning a new form? Does it create a
lot performance and memory issues? Is it better to use the Hide method
instead? And if I use the Hide method, is it true that I have to create
global variables for these forms, so that I could Show the hidden form from
another form?
 
I would not say it's a bad practice, especially if that Form is eatting up a
lot of memory. But, if it's used a lot in your appliation then I would just
hide it. As with any object, if you keep distroying it and re-creating it...
this will take time. This will also make your garbage collections slower too
because there is more to clean up.

Yes, you will have to create some type of application wide variable for the
Form if you want it used by another Form or just pass it into the second Form
in it's constructor, property or method.

Hope this helps.
David McCarter
www.vsdntips.com
 
You've definitely helped. Thank you!

dotNetDave said:
I would not say it's a bad practice, especially if that Form is eatting up a
lot of memory. But, if it's used a lot in your appliation then I would just
hide it. As with any object, if you keep distroying it and re-creating it...
this will take time. This will also make your garbage collections slower too
because there is more to clean up.

Yes, you will have to create some type of application wide variable for the
Form if you want it used by another Form or just pass it into the second Form
in it's constructor, property or method.

Hope this helps.
David McCarter
www.vsdntips.com
 
Back
Top