StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Combo values based on another combo valueExpand / Collapse
Author
Message
Posted 06/03/2008 12:08:05 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 11/17/2008 11:49:36 PM
Posts: 86, Visits: 150
Hi

I have a form that shows two Combos and other controls.

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.

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.

The form has a Bussines Object that is the one for the form, and that it's connected to the Cities table.

I have two problems here:

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

In the form code I have this for the ComboBoxState_SelectedValueChanged event

Me.CitiesBO.FillByIDState(CInt(Me.ComboBoxState.ValueMember))

But not works.

2) The first combo (the one for the state) shows in Edit state, the other combo and the rest of the controls are protected.

Thanks for your help.

regards

Everything is possible, just keep trying...

Post #16790
Posted 06/03/2008 9:13:32 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
Did you even supply the parameter value through the ListPopulating event?  This is a very common thing that is done.  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.  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:

Country SelectedValueChanged event

cboStates.Requery()

States ListPopulating Event

e.Parameters(0).Value = CType(cboCountry.SelectedValue, Integer)
Post #16796
Posted 06/03/2008 11:34:14 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 11/17/2008 11:49:36 PM
Posts: 86, Visits: 150
Hi Trent

Thanks, works perfect with your code.

Regards

Everything is possible, just keep trying...

Post #16803
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 4:03am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.125. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.