Accessing a form from 2 different forms with 2 different child-dialogs


Accessing a form from 2 different forms with 2 different child-dialogs...
Author
Message
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

I have a form which I want two call from two different forms with two different child-dialogs. Say teher is Form1 with a BO called "BestBo1". I Add a child-dialog, add the same BO to the to-be-calles form and set the properties of the child-sialog. So far, so good.

Now I need the same form for data-entry to called from another form woth a different BO. I do the same, add a child-dialog and the BO ("karteiBo1") and set the properties. I call the form with a new-sub where I pass a parameter to see what form is the parent-form.

In the Load-Event I write something like



If me.cForm = "B"  ' Called from Form 1

   Me.PrimaryBusinessObject = BestBo1

   Me.txtKollege.Businessobject = BestBo1

   Me.txtkollege.BindingField ) BestBo1.Kollege

   ....' some more controls

Else

   Me.PrimaryBusinessObject = KarteiBo1

   Me.txtKollege.Businessobject = KarteiBo1

   Me.txtkollege.BindingField ) KarteiBo1.Kollege

   ....' some more controls

Endif



But this does not wotk. Whether I call it from Form1 or Form2, I get an out-of-range-error.

So can anyone tell me if I am doing something wrong or if that whole approach is wrong.

Thanks in advance

Thomas
Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Thomas, 

What is the Gal2G.KlarneuFRM.KlarneuFRM_Load() method doing on line 197.  The ChildFormDialog control will swap out the references on the control when you call ShowDialog() on it.  The Load event is called after the references have been swapped out, so it looks like you are trying to talk to the business object that was not swapped.  If you intend to use KarteiBO1, it gets swapped by the ChildFormDialog, but not the BestBO1, it will still be empty.  In your Load handler, can you wrap the line or lines with an "If Not BestBO1.IsEmty Then" test to skip using the BestBO1 if your form is using the KarteiBO1?
Edited 12 Years Ago by Ben Chase
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ben,

thank you for your help. I found an error calling the child-form and now it almost works.

Now as the form is loaded I have another question. As i wrote, I set the properties for the used controls in the load event, which mean that I set the Businessobject and the binding field. When I edit a record I expected the content of the fields to be shown but this happens only when I set the text property too (There are only textboxes on that form)- Is it right that I have to set the text-property too or did I miss something else?

Best regards

Thomas
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