﻿<?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?)  » Nested Combo Boxes</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 04:15:14 GMT</lastBuildDate><ttl>20</ttl><item><title>Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24357.aspx</link><description>I've put in a form 3 BO's, the firs one is the grand child and the one who appneds the data to the table, ther second is a FK of this one and the third is a FK of the second one.&lt;/P&gt;&lt;P&gt;I've put two CB, the first is the grand parent FK, this CB has to pass a value to the other CB filtering this one's data and showing only data filtered by the other&amp;nbsp; CB.&lt;/P&gt;&lt;P&gt;For example I select a Customer Grand Parent CB, then an order (parent CB) and I fill in a form the data of one (and only one) item.&lt;/P&gt;&lt;P&gt;I tried a lot of examples I saw at the forum but with no success. My question is, I now how to do it manually, but I think there must be a more powerfull way via the framework.&lt;/P&gt;&lt;P&gt;I've bounded my first CB to a BO using the populationdatasourcesettings. This one works fine.&lt;/P&gt;&lt;P&gt;Then Ive bounded the second one using the method copydatafrom.&lt;/P&gt;&lt;P&gt;Ive put this code in the ListPopulating method &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub cboEstablecimientos_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles cboEstablecimientos.ListPopulating&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Parameters(0).Value = Me.BoEmpresa1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Parameters(1).Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromDefaultView&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub BoEmpresa1_Navigated(ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs) Handles BoEmpresa1.Navigated&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.cboEstablecimientos.Requery()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;But when I debug it it never reaches this code.&lt;/P&gt;&lt;P&gt;I must have some wrong parameter but I don't know which is.&lt;/P&gt;&lt;P&gt;Help please!!!</description><pubDate>Sat, 29 Aug 2009 14:39:12 GMT</pubDate><dc:creator>Felix M Avendano</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24387.aspx</link><description>Glad you got it. :)&lt;br&gt;
&lt;br&gt;
Combobox and ListView can be populated in several ways I use this rule:&lt;br&gt;
1.- If I only need the FK lookup value, then I don't add any BO to the form to populate the combo/listview, I will call the method in the Type BO instead.&lt;br&gt;
2.- If I need to reference any other fields of the lookup data then I add a BO for the lookup and then use the BO.CopyFrom(....) method to populate that BO in the form from the lookup data.&lt;br&gt;
&lt;br&gt;
Keep in mind that Combobox and ListView uses an "Internal" BO to show its data, we don't have easy access to that BO, but 99% of the time we don't need it, the BO.CopyDataFrom() will do just fine in these cases.&lt;br&gt;
&lt;br&gt;
BTW, based on your BO names "Potreros, Establecimientos, Empresa, etc." what kind of application are you building?  Are you building it in English/Español or both?</description><pubDate>Sat, 29 Aug 2009 14:39:12 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24385.aspx</link><description>Solved!!!:D&lt;/P&gt;&lt;P&gt;The question was that I was using the wrong instatiated BO, Y had to use the one Im filling with data, in this case is Potreros, and not the one I'm using to retrieve data, the parent one Empresa.</description><pubDate>Sat, 29 Aug 2009 13:36:12 GMT</pubDate><dc:creator>Felix M Avendano</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24382.aspx</link><description>I'm nearly there, believe me.:P&lt;/P&gt;&lt;P&gt;When I select the first combo a go to the second one is taking the first record instead of the selected one. This is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub cboEstablecimientos_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles cboEstablecimientos.ListPopulating&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.BoEmpresa1.Count &amp;gt; 0 Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Parameters(0).Value = Me.BoEmpresa1.Empresa&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Parameters(0).Value = 0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;What I can see is that the BO passing the parameter is the instanciated one but the BO bounded is not the same. I bounded it using the properties, but there's not an option to bound the instancieted one in the form. Something I´m missing.:hehe:</description><pubDate>Sat, 29 Aug 2009 13:20:44 GMT</pubDate><dc:creator>Felix M Avendano</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24378.aspx</link><description>[quote][b]Felix M Avendano (08/29/2009)[/b][hr]The question was more oriented to know if its correct to use one procedure instead of the other. Many thanks anyway it really been usefull. Regards.[/quote]&lt;br&gt;
&lt;br&gt;
Hi Felix,&lt;br&gt;
&lt;br&gt;
Sorry if my post was not clear.  I just meant to say that this is a dirty test project.  &lt;br&gt;
&lt;br&gt;
I am personally more inclined to use the framework's methods whenever possible, so to answer your question, yes i would use the BO methods, but when they are not suitable then we just need to create them.&lt;br&gt;
&lt;br&gt;
I simply love the flexibility provided by SF to grab the data from Combobox and ListViews, I have been able to do things almost impossible or too hard to accomplish with my past VFP framework.</description><pubDate>Sat, 29 Aug 2009 12:18:43 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24371.aspx</link><description>The question was more oriented to know if its correct to use one procedure instead of the other. Many thanks anyway it really been usefull. Regards.&amp;nbsp;</description><pubDate>Sat, 29 Aug 2009 12:02:41 GMT</pubDate><dc:creator>Felix M Avendano</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24368.aspx</link><description>Hi Felix,&lt;br&gt;
&lt;br&gt;
This sample have been used for many other test.  I do not recall any specifics other than it will show you how to get the comboboxes to behave the way you needed it to. :)&lt;br&gt;
&lt;br&gt;
Hope this gave you the jump you need to move on.</description><pubDate>Sat, 29 Aug 2009 11:42:23 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24364.aspx</link><description>OK, the example is very fine, but, what about using OrdersBO.FillByParentPrimaryKey(System.Int32) instead of &amp;nbsp;OrdersBO.FillByCustomerPK(System.Int32). Why did you create your own procedure existing one.</description><pubDate>Sat, 29 Aug 2009 11:16:35 GMT</pubDate><dc:creator>Felix M Avendano</dc:creator></item><item><title>RE: Nested Combo Boxes</title><link>http://forum.strataframe.net/FindPost24358.aspx</link><description>Hi Felix,&lt;br&gt;
&lt;br&gt;
The problem is that you need to provide a way to filter the data for the child comboboxes so whenever they are requery it will show only those related records.&lt;br&gt;
&lt;br&gt;
Here is sample posted long time ago which I used as a reference for this type of scenario.  I compiled it with the latest SF version 1.7.0.2.  You may need to point it to use the SF sample database.&lt;br&gt;
&lt;br&gt;
Pay attention at the way the combo are populated, you may need to create custom methods in your BO to grab the filtered data as shown in this sample.&lt;br&gt;
&lt;br&gt;
Good luck!</description><pubDate>Fri, 28 Aug 2009 16:21:43 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>