Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hello

i have some data in combobox.
how can i access to data in combobox winforms?

the following command can not access to them :

combobox.Items[i].tostring();


thanks.
Posted

If you need to get selected item from combobox
comboBox1.SelectedItem.Text 


For to get all data
 foreach (var item in comboBox1.Items)
{
 Console.WriteLine(item.ToString());
}

Get more details
system.windows.forms.combobox(v=vs.110).aspx[^]
 
Share this answer
 
v2
Comments
[[[Comment from OP...]]]

no the item is not selected .
i want to access all data
[no name] 14-Apr-14 13:40pm    
get all data in a foreach loop. Just defined in above
Please add a comment below the question so that OP will get notified.
You can also consider the SelectedIndex property[^].
 
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