c# - How would I check which number a selected item is in a combobox? -


i have combobox 15 items in right now. want able check if i've selected item number 1 example, or item number 7. i'm having trouble figuring out how , appreciate help.

you can use property combobox.selectedindex:

int selected = combobox.selectedindex; 

note indices zero-based, means if have selected first element, selected 0. if selected fourth one, it'd 3, , on.


Comments