﻿<?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?)  » Combo values based on another combo value</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 23:48:08 GMT</lastBuildDate><ttl>20</ttl><item><title>Combo values based on another combo value</title><link>http://forum.strataframe.net/FindPost16790.aspx</link><description>Hi&lt;/P&gt;&lt;P&gt;I have a form that shows two Combos and other controls.&lt;/P&gt;&lt;P&gt;The first combo displays a states lists (every state has an ID that is integer and the name), the combo shows only the name. This combo is filled by its own Bussines Object.&lt;/P&gt;&lt;P&gt;The second combo will only list the cities list according to the state selected in the first combo. Every citie has an ID, the ID_State, and the name the citie.&lt;/P&gt;&lt;P&gt;The form has a Bussines Object that is the one for the form, and that it's connected to the Cities table.&lt;/P&gt;&lt;P&gt;I have two problems here:&lt;/P&gt;&lt;P&gt;1) How can I filter the values of the second combo, I try using a FillByIDState where the SQL is "SELECT * FROM Cities WHERE IdState = @IdState" This is in the BO&lt;/P&gt;&lt;P&gt;In the form code I have this for the ComboBoxState_SelectedValueChanged event&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.CitiesBO.FillByIDState(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;CInt&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 size=2&gt;&lt;FONT color=#000000&gt;.ComboBoxState.ValueMember))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;But not works.&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;2) The first combo (the one for the state) shows in Edit state, the other combo and the rest of the controls are protected.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;regards</description><pubDate>Tue, 03 Jun 2008 11:34:14 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Combo values based on another combo value</title><link>http://forum.strataframe.net/FindPost16803.aspx</link><description>Hi Trent&lt;/P&gt;&lt;P&gt;Thanks, works perfect with your code.&lt;/P&gt;&lt;P&gt;Regards</description><pubDate>Tue, 03 Jun 2008 11:34:14 GMT</pubDate><dc:creator>Juan Carlos Pazos</dc:creator></item><item><title>RE: Combo values based on another combo value</title><link>http://forum.strataframe.net/FindPost16796.aspx</link><description>Did you even supply the parameter value through the ListPopulating event?&amp;nbsp; This is a very common thing that is done.&amp;nbsp; For example, we have a country combo that loads the states when the country changes...so the states ListPopulating event uses the Country combo SelectedValue to supply the country.&amp;nbsp; The other thing that you would want to do is change the population from FormLoad to Manual...so the country SelectedIndexChanged would look like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country SelectedValueChanged event&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;[codesnippet]cboStates.Requery()[/codesnippet]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;States ListPopulating Event&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;[codesnippet]e.Parameters(0).Value = CType(cboCountry.SelectedValue, Integer)[/codesnippet]</description><pubDate>Tue, 03 Jun 2008 09:13:32 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>