HELLO GUYS.. IM NEW TO THIS FORUM.. WELL.. MY I AM DEVELOPING AN HELP DESK SYSTEM AS MY FINAL YEAR PROJECT.LANGUAGE IS c#,SQL SERVER 2005,VISUAL STUIO 2010.
I HAVE 2 COMBO BOXES. FIRST ONE IS REPRESENT COUNTRY, SECOND ONE IS CITY, WHAT I NEED IS IF I SELECT A COUNTRY FROM COMBO BOX1 ALL RELATED CITY NEED TO BE LOAD FROM THE DATABSE TO COMBO BOX 2.. NOT OTHER CITIES FROM OTHER COUNTRY..

EXAMPLE.. IF I SELECT AUSTRALIA IN COMBO BOX1. COMBOBOX 2 MUST CONTAIN ONLY AUSTRALIAN CITIES.. NO ANY OTHER COUNTRY CITIES.

PLEASE SOME BODY.. HELP ON THIS TOPIC..

Recommended Answers

All 3 Replies

Hi AAXXOO welcome at daniweb :)
Unless your keyboard does not allow lower case typing: STOP SHOUTING!!!
Also please read the rules.

Have a look at the ComboBox.SelectedIndexChanged event.

You can create an event handler for this event to determine when the selected index in the ComboBox has been changed. This can be useful when you need to display information in other controls based on the current selection in the ComboBox. You can use the event handler for this event to load the information in the other controls.

Have a look at the ComboBox.SelectedIndexChanged event.

To explain a little further, in your handler for the SelectedIndexChanged event you'd query your database for cities that belong to the selected country ( select city from Cities where Country = _selectedCountry ,or whatever you'd need to do). Then you populate your City ComboBox with the results.

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.