Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Good day

I have two Comboboxes one is for Item and the Other is for Type.Now in Item i have 3 things Air, Road ,Sea in type i have

JetG5,Dreamliner,AirBus,Mercedes,Madza,Toyota,submarine ship and boat e.t.c

Now ,How when i choose Air i want JetG6,Dream liner only to appear and when I choose road Air ,Road ,Sea to appear

how do i do this?
Posted
Comments
[no name] 10-Jun-14 20:26pm    
Well the normal way would be to query a database and select the items out of the database corresponding to the Type by whatever criteria you have setup. Your current criteria makes no sense to me. If you read what you wrote, it probably would not make sense to you either. Research "cascading comboboxes".

I assume that all the ComboBoxes are loaded initially.

Now handle the ComboBox.SelectedIndexChanged Event[^]. Inside the event, see what is the selected value. Decide what needs to be removed from the other ComboBox.

Now, to remove the item from other ComboBox, do like below...
C#
// To remove "Tokyo" item:
comboBox1.Items.Remove("Tokyo");

Refer - How to: Add and Remove Items from a Windows Forms ComboBox, ListBox, or CheckedListBox Control[^]
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900