Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting rid of Forms

Status
Not open for further replies.

brd24gor

MIS
May 18, 2005
123
US
I have a question regarding the best way to get rid of a used form. For example, I start my program with a menu form. As of right now, when they click a button, I Hide() the form, create a new instance of the form that will be shown, and Show() the new form. This is done for each form in my app.

The more I think about it, the more I don't think this is the best option. Even if you hide a form, it still resides in memory until the application closes, correct? My question, then, is what is the best practice for moving from form-to-form?

Horribly newbie question, I apologize. I just don't want to inadvertently write a memory hogger that slows the machine it's running on to a stand-still.

Thanks,
Brad
 
To free some memory you have to unload the form. HINT: dispose method frees memory.
Even if you do not dispose, you can run the garbage collector (GC) every eg 2 minutes...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top