Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6891343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:23:53+00:00 2026-05-27T06:23:53+00:00

I have comboBox component and i am adding items like comboBox1.Items.Add(Item1) . But i

  • 0

I have comboBox component and i am adding items like comboBox1.Items.Add("Item1"). But i alo need to know some other info about this Item. So if i click “Item1” i need to get "102454".
Can i somehow save 102454 to “Item1” on combobox.

At web aplication there is dropdown list which look like

<select>
  <option value="102454">Item1</option>
</select>

and when i click “Item1” i get 102454.

Can i do this in windows desktop applicatin with combobox?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:23:54+00:00Added an answer on May 27, 2026 at 6:23 am

    Edit better solution:

    Use a KeyValuePair and ValueMember \ DisplayValue:

    comboBox1.ValueMember = "Key";
    comboBox1.DisplayMember = "Value";
    
    comboBox1.Items.Add(new KeyValuePair<int, string>(102454, "Item1"));
    

    As Kristian points out this can be extended to be even more flexible – you can put whatever object you like into the list of items, and set the value and display members on the combobox to be whatever property path you want.


    To get the key back later you can do this:

    var item = combobox1.SelectedItem;
    
    int key = ((KeyValuePair<int, string>)item).Key;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combobox from which i need to programmatically disable items depending on
I have an actionscript-instantiated component in a containment hierarchy; it extends ComboBox, but it's
I have created a custom facelets component and I need to set some value
I have a ComboBox that I set up like this: this.cmbCustomerJob.DisplayMember = display; this.cmbCustomerJob.AutoCompleteMode
I have a ComboBox hosted in a ListView and I need changes in the
I have a combobox that passes along values in text, but they can have
I have been defined some ComboBox element: <ComboBox Height=27 Margin=124,0,30,116 Name=cbProductDefaultVatRate VerticalAlignment=Bottom ItemsSource={Binding}> <ComboBox.ItemTemplate>
I have an editable ComboBox component and I want to reference the TextInput that
I would like to add a button to the combobox ItemTemplate, that allows the
I have a JComboBox component in the panel and ItemListener attached to it. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.