StrataFrame Forum

I Have error when started my form

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

By Rafael - 8/22/2008



UIException

Dynamically populating the ListView failed. Could not create and fill the business object of type 'GoLiveCorporate.sysPedidoCompraItemBO'

TargetInvocationException

Uma exceção foi acionada pelo destino de uma chamada.

BusinessLayerException

The ParentBusinessObject property must be set before FillByParent can be called with no parameters supplied.



Source : MicroFour StrataFrame UI



Stack Trace:

em MicroFour.StrataFrame.Business.BusinessLayer.FillByParent()

em System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

em System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

em System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

em System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

em MicroFour.StrataFrame.UI.Windows.Forms.ListView.GetFilledBusinessObject(Object[] Parameters)

em MicroFour.StrataFrame.UI.Windows.Forms.ListView.PopulateListView(Object[] Parameters)

em MicroFour.StrataFrame.UI.Windows.Forms.ListView.InitializeObject()

em MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()

em MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)

em System.Windows.Forms.Form.OnCreateControl()

em System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

em System.Windows.Forms.Control.CreateControl()

em System.Windows.Forms.Control.WmShowWindow(Message& m)

em System.Windows.Forms.Control.WndProc(Message& m)

em System.Windows.Forms.ScrollableControl.WndProc(Message& m)

em System.Windows.Forms.ContainerControl.WndProc(Message& m)

em System.Windows.Forms.Form.WmShowWindow(Message& m)

em System.Windows.Forms.Form.WndProc(Message& m)

em System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)

em System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)

em System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)





 PopulationDataSourceSettings = sysPedidoCompraItemBO.FillByParent() 
By Greg McGuffey - 8/22/2008

Rafael,



There are two things you need to do to use the FillByParent:



- The sysPedidoCompraItemBO must be configured with a parent child relationship. This is done once for the BO in the designer of that BO (i.e. not for an instance dropped on the form).



- You must supply the instance of the parent to the instance of sysPedidoCompraItemBO on any form that will use that relationship.



The second can be done in a couple of ways. The easiest is to just set it for the instance dropped on the form. This of course means that an instance of the parent must be dropped on the form also.



The other is to just supply an instance of the parent to FillByParent.



Hope that makes sense. If not, just ask some more questions!
By Trent L. Taylor - 8/22/2008

You did not provide the parameter needed in the ListPopulating event.  You selected a method which requires a parameter, this parameter must be supplied in the ListPopulating event.  There are a lot of samples on how to do this including the StrataFlix sample found here: http://forum.strataframe.net/FindPost18186.aspx 

There is also a sample called Advanced List Population and others as well as a lot of documentation explaining how to do this.  But if you are like me, I prefer to look at samples first.  I recommend taking a look at the StrataFlix sample as this will cover the most ground all around including how to populat a ListView.

As a side note, you are not going to want to use the FillByParent method inside of the ListView.  More than likely you will want to call the FillByParentPrimaryKey or possibly the CopyDataFrom methods if you already have another BO with data within it. 

But in short, please refer to the samples to see how to properly set this up.  Thanks.