I have one combox and i want to add value like.when user will click on combox he will see name “Dan”,”Peter”,”David” but value behind the name shoud be “1”,”2″,”3″ IDs of name.How will i do this in C# windows combo.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re looking to use the
ValueMemberandDisplayMemberproperties of the combobox. MSDN ExampleShort sample:
Then just make sure to set ID as the
ValueMemberand Name as theDisplayMember. Add a collection of Foo’s and you’re all set.