By vblain - 6/2/2006
I tried to set the listview propertie "PopulationDataSourceSettings" to "Location.CopyDataFrom(MicroFour.StrataFrame.Business.BusinessLayerBase,MicroFour.StrataFrame.Business.BusinessCloneDataType)" but i get the below error when doing so. Now if i select the FillAll Function i created no problem i get the data to show up. What am i doing wrong.Vince UIException Dynamically populating the ListView failed. Could not create and fill the business object of type 'DiscoverSuccess_Business.Location' TargetInvocationException Exception has been thrown by the target of an invocation. NullReferenceException Object reference not set to an instance of an object. Source : MicroFour StrataFrame UI Stack Trace: at MicroFour.StrataFrame.Business.BusinessLayer.CopyDataFrom(BusinessLayerBase BusinessObject, BusinessCloneDataType CopyType) at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at MicroFour.StrataFrame.UI.Windows.Forms.ListView.GetFilledBusinessObject(Object[] Parameters) at MicroFour.StrataFrame.UI.Windows.Forms.ListView.PopulateListView(Object[] Parameters) at MicroFour.StrataFrame.UI.Windows.Forms.ListView.InitializeObject() at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects() at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
By vblain - 6/2/2006
the FillAll function seems to work okay. but now i can't get the list to sync with the business object.Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChangedIf ListView1.SelectedItems.Count > 0 ThenMe.Location1.NavigateToPrimaryKey(CType(Me.ListView1.SelectedItems("id").Tag, Integer))End IfEnd Sub System.NullReferenceException was unhandled by user code Message="Object reference not set to an instance of an object." Source="DiscoverSuccess_WinApp" StackTrace: at DiscoverSuccess_WinApp.LocationMaintenance.ListView1_SelectedIndexChanged(Object sender, EventArgs e) in C:\Documents and Settings\Vince\Desktop\Discover_Sln\DiscoverSuccess_WinApp\LocationMaintenance.vb:line 51 at System.Windows.Forms.ListView.OnSelectedIndexChanged(EventArgs e) at System.Windows.Forms.ListView.WmReflectNotify(Message& m) at System.Windows.Forms.ListView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
By StrataFrame Team - 6/3/2006
Hey Vince, Basically, when you use a method within the PopulationDataSourceSettings that requires parameters, you have to pass the parameters through either the Requery() method on the list view, or through the ListPopulating event like this: Requery(): ListView1.Requery(BOContainingRecords, BusinessCloneDataType.ClearAndFillFromCompleteTable)
ListPopulating event: Private Sub ListView1_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles ListView1.ListPopulating e.Parameters(0).Value = BOContainingRecords e.Parameters(1).Value = BusinessCloneDataType.ClearAndFillFromCompleteTable End SubWhen the list populates, it creates it's own instance of the business object type you selected within the PopulationDataSourceSettings and executes the method on it. So, the CopyDataFrom method is going to be called on the temporary business object within the list, copying the records from the business object you want into the temp one. The list is then built from the temp one. So, you have to use one of those 2 methods (but not both) to specify the parameters for the method that is executing. As for your second problem, you might change this line: Me.Location1.NavigateToPrimaryKey(CType(Me.ListView1.SelectedItems("id").Tag, Integer)) to this: Me.Location1.NavigateToPrimaryKey(CType(Me.ListView1.SelectedItems(0).Tag, Integer)) I'm not sure what it's going to do when you try to get the selected item with "id". The SelectedItems property is just a collection, so calling SelectedItems(0) just gets the first one within the collection. Give that a shot and let me know how it works.
|
By vblain - 6/6/2006
Ben Chase (06/03/2006)
Hey Vince, Basically, when you use a method within the PopulationDataSourceSettings that requires parameters, you have to pass the parameters through either the Requery() method on the list view, or through the ListPopulating event like this: Requery():ListView1.Requery(BOContainingRecords, BusinessCloneDataType.ClearAndFillFromCompleteTable) ListPopulating event  rivate Sub ListView1_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles ListView1.ListPopulating e.Parameters(0).Value = BOContainingRecords e.Parameters(1).Value = BusinessCloneDataType.ClearAndFillFromCompleteTable End Sub When the list populates, it creates it's own instance of the business object type you selected within the PopulationDataSourceSettings and executes the method on it. So, the CopyDataFrom method is going to be called on the temporary business object within the list, copying the records from the business object you want into the temp one. The list is then built from the temp one. So, you have to use one of those 2 methods (but not both) to specify the parameters for the method that is executing. As for your second problem, you might change this line: Me.Location1.NavigateToPrimaryKey(CType(Me.ListView1.SelectedItems("id").Tag, Integer)) to this: Me.Location1.NavigateToPrimaryKey(CType(Me.ListView1.SelectedItems(0).Tag, Integer)) I'm not sure what it's going to do when you try to get the selected item with "id". The SelectedItems property is just a collection, so calling SelectedItems(0) just gets the first one within the collection. Give that a shot and let me know how it works.
Hi after reading the help file and going through the sample project and tutorials i think that just using the browse button is much better. Why stay with something that dates back to an old framework that i'm trying to replace anyways . Thanks for the help on this, i had actually figure my error when thinking that navigating to primary key was basically an array so how would it ever know what the name of the colum is.
|
By Trent L. Taylor - 6/6/2006
Glad you found your answer. Let us know if you need anything else.
|
|