why always dispose?

  • Thread starter Thread starter codymanix
  • Start date Start date
C

codymanix

Why does the Windows forms designer always insert a Dispose() method in my
Form-classes? The dispose methods is always the same and does nothing other
than the base-implementation would do. So why?
 
Hi,
codymanix said:
Why does the Windows forms designer always insert a Dispose() method in my
Form-classes? The dispose methods is always the same and does nothing
other
This methods clears the components container which is memeber variable of
the form:
private System.ComponentModel.Container components = null;

This collection holds components (which are not controls) like Timer,
ImageList and so on. The dispose methods disposes those components.

HTH
B\rgds
100
--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
 
Why does the Windows forms designer always insert a Dispose() method in
my
other
This methods clears the components container which is memeber variable of
the form:
private System.ComponentModel.Container components = null;

This collection holds components (which are not controls) like Timer,
ImageList and so on. The dispose methods disposes those components.


This can also be done in the implementation of the base-class. I don't the
sense in repeating the same code in every derived class.
 
Hi,
in


This can also be done in the implementation of the base-class. I don't the
sense in repeating the same code in every derived class.
In this case the designer will show all components that the base class has.
Your view will be cluttered with components that you haven't put there and
you don't know what they are used for. If worse comes to worst and you
delete one of them it is most likely the control will stop working properly
and you cannot add it back because it will be member of your new class and
the base class won't have access to it.

B\rgds
100
 
Back
Top