﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » ChildForm with a ListView</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 10:26:36 GMT</lastBuildDate><ttl>20</ttl><item><title>ChildForm with a ListView</title><link>http://forum.strataframe.net/FindPost21613.aspx</link><description>Hi&lt;/P&gt;&lt;P&gt;I have a form with a parent BO and several child BO's, in the main form I use several Listview's and child forms to handle tha data and works pretty well, click on the Edit and the ChildForm shows and let me edit the record.&lt;/P&gt;&lt;P&gt;But I need to open a Child that shows a list of records (ListView)&amp;nbsp;not only one record like all other child's. This ChildForm of course is a related to the main form and should shows the records related to the record selected in the main. I follow the same logic that the other children, establish the relationship and open the form, but How should I fill the data in the list?&lt;/P&gt;&lt;P&gt;The scenario is this, the main form is a Products form, the child form will be open if the product is a kit, so the child windows should have a list with products that are part of the kit, so in this form I have a New, Edit and Delete buttons. The problem is how should the ListView PopulationDataSourceSettings shoud go?&lt;/P&gt;&lt;P&gt;Thanks for your help</description><pubDate>Wed, 21 Jan 2009 20:45:21 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: ChildForm with a ListView</title><link>http://forum.strataframe.net/FindPost21615.aspx</link><description>Hi Juan,&lt;P&gt;Let me see if I understand your situation here:&lt;/P&gt;&lt;P&gt;You need to show items in the ListView for Products that are flagged as Kit, right?&lt;/P&gt;&lt;P&gt;If so you need to do the following in the ListView:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Set the Listview1.PopulateOnFormLoad = Manual&lt;/LI&gt;&lt;LI&gt;Set the Listview1.PopulateDataSourceSettings to CopyDataFrom(BusinessLayerBase,BusinessCloneDataType)&lt;/LI&gt;&lt;LI&gt;In the ListPopulating event, set the Parameters as follow:&lt;/LI&gt;&lt;/OL&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT size=2&gt;&lt;P&gt;[codesnippet][code]e.Parameters(0).Value = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ProductsBO&lt;/P&gt;&lt;P&gt;e.Parameters(1).Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromDefaultView&lt;/P&gt;&lt;P&gt;[/code][/codesnippet]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="MARGIN-RIGHT: 0px"&gt;Now in the ProductsBO.Navigated event put code to filter the listview data and&amp;nbsp;requery the ListView as needed, something like this:&lt;/P&gt;&lt;P style="MARGIN-RIGHT: 0px"&gt;[codesnippet][code]&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/P&gt;&lt;P&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.ProductsBO.Count &amp;gt; 0 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;'-- Filter all the order items for the current Order PK&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ChildBO.Filter = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"KitFlag="&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ChildBO.KitFlag.ToString&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;' Force the ListView to Requery to Enable/Disable its toolbar&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ListView1.Requery()&lt;/P&gt;&lt;P style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;[/code][/codesnippet]&lt;/P&gt;&lt;P style="MARGIN-RIGHT: 0px"&gt;This is just one approach to give you an idea, of course if the child BO may have a lot of record for the same parent, then instead of using the CopyDataFrom method in the PopulateDataSourceSettings you can create a method in your ChildBO with a parameter to get the data related to the parent with the KitFlag value, and you set those values as parameters in the ListPopulating Event.&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 21 Jan 2009 20:45:21 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>