Combobox SetItemData in c#

Posted on 2009-05-28
Medium Priority
Last Modified: 2013-12-17
When I add items to a combobox like so:
 comboBoxMatchesPlayed.Items.Add("Blah Blah");

Can I also do a 'setItemData' for this entry e.g set its data to be either a int value or even a string value.

you see I want to display data in the combo box so users can read it easily but I want to give a corresponding ID to each entry so it can easily access a database table.
Question by:Wanting2LearnMan
1 Comment
LVL 39

Accepted Solution

Pratima Pharande earned 2000 total points
ID: 24491329
try this

 ListItem lst = new ListItem() ;
            lst.Text = "text";
            lst.Value = "ID";


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Native ability to set a user account password via AD GPO was removed because the passwords can be easily decrypted by any authenticated user in the domain. Microsoft recommends LAPS as a replacement and I have written an article that does something …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question