I think that Tom Shelton's suggestion would probably work.
But you might want to further define the relationship of the clsProduct to the
Collection.
Will clsProduct always belong to this type of Collection, or could it exist
outside the collection?
Could it exist in a different collection?
Do other objects besides the collection need to respond to Events from
clsProduct?
Basically, I'm trying to determine if a common Parent/Child relationship exists.
If that is the case, IMHO Events would be an inefficient way to go.
Hooking / Unhooking Events can be time consuming, you have no guarantee of when
the Event will be processed and/or which order, etc.
If a true Parent/Child relationship exists, then I would add a Parent property
to the clsProduct and assign it to the Collection when Adding. And of course
unassigning if removing.
Then when the Child is modified, it could just directly call an appropriate
method on the Parent.
This can be easily achieved using strongly typed parameters, or with Interface
Implementation.
Say a Child is modified, it could call the ChildModified Sub on it's parent.
clsProduct.Quantity changes, then in the Quantity property it could call
me.Parent.ChildModified(me)
I know that explanation was a little dis-jointed, but hopefully it made sense.
Gerald
"Franky" <fr***************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
IN vb.Net
Class clsCommande Inherits CollectionBase
and
Class clsProduct
clsCommand contain a IList of clsProduct
the clsProduct.Quantity property Raise an Event : Events ProductModify().
- How can I trap this event in clsCommande ?
__________________________________
Franky
Franky_NOSPAM_@Boucher_NOSPAM_os.com