Hello Everyone, I have a task that invlolve two or more comboboxes, simply put I want a combobox that is populated with state of a country and another with cities in the state.I know I have to populate from Database which isnt a problem. Now to populate the state combobox I have this Private function.

Private Sub StatePopulateCombo(ByVal cbox As ComboBox)
        cbox.Items.Add("Newyork")
        cbox.Items.Add("California")
        cbox.Items.Add("Texas")
        cbox.Items.Add("Montana")
        cbox.Items.Add("Michigan")
        cbox.Items.Add("Oregon")
        cbox.Items.Add("Arizona")
End Sub

and will call this up for every combobox I want to populate with the state of the country

StatePopulateCombo(ComBoxState)

Now I want another Funtion or sub that will populate another combobox with cities of each state based on state selected from the previous combobox.

Thank you in aniticipation.

Basically, you'll want to handle the SelectedIndexChanged event of the combobox holding the state names. The method for handling this event will allow you to add the code to change the contents of the other combobox.

Thank you Mr tinstaafl. I have actually got it solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.