Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:52:16+00:00 2026-06-03T23:52:16+00:00

Being a newby in .NET land and coming from a Delphi background, I am

  • 0

Being a newby in .NET land and coming from a Delphi background, I am accustomed to create controls dynamically and FREE them manually when needed.

In .net, being garbage collected and so, I guess you don’t need to explicitly free the controls.

In my case (WinForms), I dynamically populating a flowLayoutPanel with panels, that contains some other controls. In some cases, I need to remove some panels. What I’m doing to achieve that is

flowPanel.Controls.Remove(thePanelToRemove);

This have the needed effect: the panel disappears from the flowLayoutPanel, but what I don’t get is: does the garbage collector deletes the control? That would be the desired behavior because I will be creating lots of controls that won’t be used anymore when the user deletes them. If not, how can I be sure that the controls get freed? Something like (pseudocode)

flowPanel.Controls.Remove(thePanelToRemove);
thePanelToRemove.Free();

or similar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:52:17+00:00Added an answer on June 3, 2026 at 11:52 pm

    Short answer: yes, the garbage collector will remove the control when memory is needed.

    Longer answer: Some controls claim resources that can’t be freed by the garbage collector. Those controls implement the IDisposable interface and you should call dispose on the control when you no longer need it. The Dispose will clean up these unmanaged resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having an application being developed in ASP.NET MVC2. There is a style
Using Backbone.JS, I am able to successfully create new models and save them to
Being new to c#, I don't understand how variables are passed between objects. My
Being new to SQLAlchemy, I was wondering at what time would Session() should be
Being spotted in context of this question this seemingly inconsistent behavior can be reproduced
Being new to OpenCL i would like to know if the following scenario is
Being quite new to rails and currently building a project, i'm begining to be
Being fairly new to programming, I am having trouble understanding exactly what Homebrew does...
Being curious about how maven works exactly, I've checked out its source codes. Astonishingly,
Being a Java developer in an agile development cycle, I have learnt that it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.