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..

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.

This article has been dead for over six months. Start a new discussion instead.