StrataFrame Forum

ChildForm Dialog Issue

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

By Tim Dol - 10/24/2007

I have a child form that contains a grid, with BBS, and two business objects. I placed a childformdialog control on my parent form and entered my business object translation items.  I checked the datatables on my child form business objects and everything is fine, however my grid will not display the data. (My textbox's are fine). The only way I can get it to display the records on the grid is to actually fill the business object within the child form itself.

Any ideas on how I can solve this issue without filling the business object on the child form?

Thanks

Tim

By Trent L. Taylor - 10/24/2007

Any ideas on how I can solve this issue without filling the business object on the child form?

This has to do with the instantiation order.  The reason you are seeing this behavior is because at the time the grid is being populated the BOs have not yet been translated.  If you wait until further down the execution string, for example the OnLoad of the form, you will see the populated BOs.  For example, if you put a breakpoint in the constructor of the form, you will see that the BOs on the child form do not have any records in it.  However, if you put the breakpoint in the Load after the Base call, you will see that it will have records.

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        MyBase.OnLoad(e)
        '-- Check for records here
    End Sub

So you may need to "refresh" the grid or not bind the BBS to the grid until after the load to get the behavior you are expecting.

By Tim Dol - 10/26/2007

Hi Trent,

I see the data is populated by time it hits the Load event but not in the constructor.  I have tried a number of ways to 'refresh' the data, however I still can't get the data to appear.

1) I've tried setting the grid's datasource at run-time, as suggested. No Luck.

2) I tried Ben's suggestion of creating a new class, inherit from business binding source, add a method 'ResetDataSource' to call

Me.OnListChanged(New ListChangedEventArgs(ListChangedType.Reset, -1))

I emailed you a sample project I put together simulating what I'm trying to accomplish. I would appeciate if you could take a quick look to make sure I'm not missing something.

Thanks

Tim