I have an object o1 that has a child o2.o2 has a child o3.i create a new instance of o2 like this
Public Shared Function NewO2(ByVal O1 As O1) As O2NewO2 =
New O2NewO2._O1 = O1
'parentNewO2.MarkAsChild()
NewO2.Validate()
End Functionsimilarly when i create a new instance of o3 i pass in the o2 instance as a parameter and assign to a member variable of o3 .
I have added the following lines is the o2 class to fire the validate method of o2 when the parent o1 becomes dirty as i need to so some validation when o1 changes.I have done same in o3 class adding isdirtychanged on o2 and calling the me.validate of o3.
Private Sub _O1_IsDirtyChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles _O1.IsDirtyChanged Me.Validate() End SubMy problem now is that there is property on o1 that changes based on which a validation's should be called on o3 .is there a was to do this with out passing in o1 along with o2 to the shared method to create an instance of o3
Thanks,
AGN.
You could always look at it from the other direction.
For example, you "know" that O1 may cantain a child and grandchild (but maybe not always.)
So you write a rule in O1 that tests if mO2 Is Nothing and if it is not then test if mO3 Is Nothing and if not then go ahead and evaluate the rule in O1 when the O1 property changes.
Joe
Copyright (c) Marimer LLC