471,330 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

what is IContainer components for?

When I create a new form a private member
System.ComponentModel.Container components
is created, and appears to be passed to the constructors of various things
like timers.
Can someone explain to me what the purpose of this is. It seems to have
something to do with the Dispose method. If I create (say) a timer manually
in the code and don't pass the components object in the constructor
everything still seems to work OK.
--
Dave
Jan 25 '06 #1
1 12332
Dave,

some of the components hold on unmanaged resources that needs to be released
upon destroing the component. Forms and UserControls use the container
collection to keep track of such components so they get disposed along with
the form or user control.

Beside this IContainer component collection are used in design time by the
desingener host to keep track of all objects on the design surface. However
it has nothing to do with the Container object that you see in the Form
class.
--
HTH
Stoitcho Goutsev (100)

"Dave" <Da**@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
When I create a new form a private member
System.ComponentModel.Container components
is created, and appears to be passed to the constructors of various things
like timers.
Can someone explain to me what the purpose of this is. It seems to have
something to do with the Dispose method. If I create (say) a timer
manually
in the code and don't pass the components object in the constructor
everything still seems to work OK.
--
Dave

Jan 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Lasse Edsvik | last post: by
1 post views Thread by Francois Vanderseypen | last post: by
2 posts views Thread by Oberon | last post: by
4 posts views Thread by SamSpade | last post: by
3 posts views Thread by tcloud | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.