how do I notify child controls of a change in the parent

Posted by fishhead on Stack Overflow See other posts from Stack Overflow or by fishhead
Published on 2010-04-21T17:35:37Z Indexed on 2010/04/21 17:43 UTC
Read the original article Hit count: 217

Filed under:

what is the best way to keep a child control up to date for changes in the parent.

I have a number of child controls hosted inside my parent object and I can think of two ways to send change information to them.

1) wire the child control to an event in the parent. and fire that event on a change in the parent

2) keep a list of the children in an array and intenerate through the array when the change has happened and invoke a method in the child to handle the new changes.

I hope I describe it okay.

both work but there is probably a right way to handle this and a wrong way.

© Stack Overflow or respective owner

Related posts about c#