How to access another form's Business Object?


Author
Message
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
Hello,

I have a form that is used to insert to it's primary BO. Only some of the fields would be populated from the form's UI. The rest I'd like to set from a parent form when I show the child form. How do I refer to the child form's BO from the parent form?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The first thing I'd look into is using a ChildFormDialog. This can manage parent child relationships pretty easily. Take a look at the help topic on this control (Application Framework - UI Layer - Controls).

To more directly answer the question, in the property window for the BO instance on the form and set its Modifiers to Public. Then, if you have an instance of the form, the BO will be a property of that instance.
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 29, Visits: 125
Thank you for your replay. I did consider using a ChildFormDialog for this problem, but the thing is that in my parent form my bo is wrapped in the custom business binding source, and therefore it is not visible at design time, during the configuration of the ChildFormDialog. If there's a way to work around that, let me know.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Hmmm...well, this is sounding interesting and the ChildFormDialog may not be the way to go. Another option I thought of was to pass the parent BO to the child form in a constructor, then set the parent BO to a property of the child form:

Public Class MyChildForm

    Public Sub New(parentBO As MyParentBOType)
        Me.ParentBO = parentBO
    End Sub

    Private _parentBO As MyParentBOType
    Public Property ParentBO As MyParentBOType
        Get
            Return _parentBO
        End Get
        Set(value As MyParentBOType)
            _parentBO = value
        End Set
    End Property
End Class

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