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 9174709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:47:49+00:00 2026-06-17T16:47:49+00:00

I am filling a combobox with dropdown values of type WagonType . The function

  • 0

I am filling a combobox with dropdown values of type WagonType. The function I am calling returns a dictionary where the key is the WagonTypeID and the value is the WagonType.

RepositoryItemComboBox comboWagonTypes;
Dictionary<int, WagonType> GetAllWagonTypes()
{
  ...
}

If I use AddRange to fill the collection will it insert only the values or both the keys and the values?

comboWagonTypes.Items.AddRange(GetAllWagonTypes());

Or do I need to iterate through the dictionary and insert the values myself?

foreach (var wagonType in GetAllWagonTypes())
   comboWagonTypes.Items.Add(wagonType.Value)
  • 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-06-17T16:47:50+00:00Added an answer on June 17, 2026 at 4:47 pm

    You need to use the Values property of the dictionary.

    Just do

    comboWagonTypes.Items.AddRange(GetAllWagonTypes().Values);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm filling a ComboBox with DataGridView cells' values. Now, I don't want to repeat
I want to build a combobox with key->postal and value->city to use as filter
I have a 2 Table. Product ProductName CategoryID Category ID CategoryName I'm filling combobox
I am filling a drop down based on the value selected in the first
Using C# & MySQL When i select a particular value from the combobox then
I have a jComboBox in my Swing GUI, filling the value from my SQL
After filling in my form with values. Clicking on f.submit just refreshes my view
I'm working on filling in an Rd file for a function. When I use
I am filling items to my ComboBox from a XML file using a DataTable.
I am filling up a Stackpanel with Textboxes. Each textbox, Should display the Value

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.