StrataFrame Forum

Browse Dialog in a Child form

http://forum.strataframe.net/Topic2877.aspx

By Ivan George Borges - 9/18/2006

Hya.

I put a BrowseDialog in a child form.

It shows up fine, the search fields are there, the records get listed, but once I choose one and go back to the form, it doesn't position the BO to the chosen record.

Am I missing something? (besides the beautiful windy and sunny day out there)

By Trent L. Taylor - 9/18/2006

You need to set the BusinessObjectToPopulate property on the business object.  This is the BO that gets updated with the results located from the browse when you click the OK within the BrowseDialog.

yup...I would agree that it would be more fun outside today Smile

By Ivan George Borges - 9/18/2006

Trent L. Taylor (09/18/2006)
You need to set the BusinessObjectToPopulate property on the business object. 

It is already Trent.

It is working fine in all the other forms. It's just in this ChildForm that it is not. In the parent of this form, it works fine.

By Ivan George Borges - 9/18/2006

(hope you notice when I say "all the other forms", I'm trying to show off)
By Trent L. Taylor - 9/18/2006

Is the business object that is attached to the browse a translated business object?  This could possibly be a dangerous situation if you are changing the contents of the business object that is managed on the parent form.  However, if the child form has a browse that is not going to kill your parent/child logic you will be fine. 

If you look at the contents of the BO after the browse, does the record actually exist in the BO...first lets make sure that the data made it back.

By Trent L. Taylor - 9/18/2006

(hope you notice when I say "all the other forms", I'm trying to show off)

That's funny!.....I noticed BigGrin 

By Ivan George Borges - 9/18/2006

Trent L. Taylor (09/18/2006)
Is the business object that is attached to the browse a translated business object?  This could possibly be a dangerous situation if you are changing the contents of the business object that is managed on the parent form.  However, if the child form has a browse that is not going to kill your parent/child logic you will be fine. 

If you look at the contents of the BO after the browse, does the record actually exist in the BO...first lets make sure that the data made it back.

Yes, it is a translated business object.Blush

It is a one-to-many situation. Have the parent, a button there calling the child form. This parent may have lots of kids, so I put a Browse dialog in the child ToolStrip. Then I set the BOToPopulate to the BO in the Child, and its Type. When I go to the Browse and do a Search, the grid gets populated alright. I click the chosen one and go back to the child form, that's when it doesn't show the record I chose, but it stays in the one it was already.

Too confusing? Would you like me to try and explain in Portuguese? You can ask Steve to help in the translation...BigGrin

By Trent L. Taylor - 9/18/2006

Too confusing? Would you like me to try and explain in Portuguese? You can ask Steve to help in the translation...

LOL...yeah, I'll get him in here to translate for me.  When you return from the browse, does the BO contain the correct data?  It so, try calling the BO.Refresh()...this will force your bound controls to refresh to the current record in the BO.

By Ivan George Borges - 9/18/2006

Trent L. Taylor (09/18/2006)
[quote]When you return from the browse, does the BO contain the correct data? 

Yes, it does, but not positioned in the correct row.

[It so, try calling the BO.Refresh()...this will force your bound controls to refresh to the current record in the BO.

Extremely sorry for the stupid question, but where could I call the Refresh?

By Trent L. Taylor - 9/18/2006

It is on the business object.  For example:

MyBO.Refresh()

By Ivan George Borges - 9/18/2006

I meant where (which method, event) in the parent should I put this line of code.

Well, I put it in the Activate method, no lucky.

By Trent L. Taylor - 9/18/2006

Just to prove and see if the refresh fixes the issue, just put a button on your form and add the code to do the refresh when you come back from the browse.  If the refresh works then I will try to think of a place to add the code so it is automatically called.
By Ivan George Borges - 9/18/2006

Never mind Trent, don't want to take your time with this.

Id doesn't change anything. I press the button to refresh but it seems it is stoped in the row it is showing.

I can continue with the forms and surely will find out what I did here.