ChildFormDialog & ParetnBusinessObject


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)StrataFrame VIP (1.9K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
I had an issue with a parent/child object relationship. It's working now but I'd just like to understand what was going on.

Form 1
     Contains BO1
     BO1 is passed to Form 2 using a ChildFormDialog

Form 2
    Contains BO1 translated by CFD
    Contains BO2 (ParentBusinessObject set to BO1 in the designer)

At runtime the ParentBusinessObject property for BO2 is Nothing even though it was set to BO1 in the
designer. If I set the relationship in code on Form 2 everything works as it should. I'm assuning that the
translation of BO1 by the ChildFormDialog is messing up the relationship set in the designer.

Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Larry,



I can't find the posts I've done related to this, but here is my understanding.



In the designer file, in the InitializeComponent() method:

1. A new instance of BO1 is created and the pointer stored in your BO1 variable.

2. A new instance of BO2 is created and a pointer stored in your BO2 variable.

3. The ParentBusinessObject property of BO2 is set to BO1, or the pointer that is held in BO1 is stored in that property



During Form Load:

4. The translations happens from BO1 on parent form to BO1 on child form. I.e. the pointer that the BO1 variable holds is changed to point to the BO1 on form one. I believe that the translation will also handle updating the pointers used for binding, but it doesn't attempt to handle things like parent BO properties. I.e. the ParentBusinessObject of BO2 is still pointing to the BO1 that was created in InitializeComponent.

5. You then manually reset the ParentBusinessObject of BO2 to BO1 (which seems like you're repeating yourself, but the pointer stored by BO1 has changed).



Hope that is clear. My brain hurt for a bit until I got this figured out. Crazy
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search