Combo values based on another combo value


Author
Message
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)StrataFrame User (310 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

Sorry for the last post, It was completly wrong.

Hope this time I can explain better.

I want to fill a Combo according the value of another Combo.

I have this scenario

Table States

IdState - Int32

Statename - String

Table Cities

IdCity - Int32

IdState - Int32

CityName - String

Table Streets

IdStreets - Int32

IdCity - Int32

IdState - Int32

StreetName - String

The three tables have relations defined.

I create a form to mantein the states, the a form to mantein the cities and all fine.

I create a new form to mantein the streets, and here is my problem. In this user first select the state from a combo and the according to the selected state a second combo must be filled with only the cities of the state selected in the first combo.

There are three BO, one for the form, another for the States and a thierd one for the cities.

In the BO of the cities I have this:

Public Sub FillByState(ByVal State As Integer)...

loCommand.CommandText = "SELECT * FROM Cities WHERE IdState = @IdSate"

...

End Sub

The fill is copy of the one used in the tutorial. The PopulationDataSourceSettings for the CitiesBO are set to execute the FillByState: CitiesBO.FillByState(System.Int32) and PopulateOnFormLoad is FormLoad

In the combo of State I add this code for the SelectedvalueChanged event

Me.CitiesBO.FillBySate(Me.ComboBoxState.SelectedValue)

Me.ComboBoxCities.Requery()

But when I select a state the combo for the cities is not filled.

What do I need to do?

Regards



Smile Everything is possible, just keep trying...
Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Good stuff Smile  Good answers, Edhy!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Juan Carlos Pazos - 17 Years Ago
Edhy Rijo - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Juan Carlos Pazos - 17 Years Ago
                     Good to hear :)
Trent L. Taylor - 17 Years Ago
                         Hi I already use your model and works fine with two combos, but now I...
Juan Carlos Pazos - 17 Years Ago
                             Juan Carlos, it is the same rule for all combos you want to use. The...
Edhy Rijo - 17 Years Ago
Juan Carlos Pazos - 17 Years Ago
Edhy Rijo - 17 Years Ago
Juan Carlos Pazos - 17 Years Ago
Edhy Rijo - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Juan Carlos Pazos - 17 Years Ago
Juan Carlos Pazos - 17 Years Ago
             You're welcome Juan.
Edhy Rijo - 17 Years Ago
                 Good stuff :) Good answers, Edhy!
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search