Possible Duplicate:
When and why should I implement IComponent, IContainer, and ISite?
Every time I create new control, Visual Studio adds the next field
private System.ComponentModel.IContainer components = null;
But never uses it. What for?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
A user control is simply a what to create your own “control”. If that control consists of other child controls, then those controls should be disposed of when your control is disposed of (common courtesy for Disposable objects, etc.).
User control is a parent control in this respect; so, by default the class creates a container for these child controls. You’re able to “design” the user control in the Designer and drag-and-drop controls from the toolbox onto the design surface–which knows about the
componentsfield and makes sure those child controls are added to the collection.