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

  • SEARCH
  • Home
  • 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 544917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:42:21+00:00 2026-05-13T10:42:21+00:00

I am mostly an ASP.NET developer but I am working on a WinForms app

  • 0

I am mostly an ASP.NET developer but I am working on a WinForms app and noticed a large difference between the ASP.NET combobox (html select) and that of WinForms. I found (maybe incorrectly so) that WinForm’s combobox only has a “label” whereas ASP.NET allows you to specify a “label” and a “value”.

I am looking to use a WinForms combobox (or another comparable control) with a label and a value (Foobar / 42329). Is this possible? I have attempted to search for the answer but haven’t come up with much. If there is no way to accomplish that, how does one go ahead and design a WinForm combobox that would represent say Cities with their associated database id?

  • Toronto / 2324
  • Montreal / 64547
  • Vancouver / 1213
  • 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-13T10:42:21+00:00Added an answer on May 13, 2026 at 10:42 am

    I can think of a few ways:

    • override the ToString() of a City class to return Name + " / " + Id;
    • ditto, but with a TypeConverter
    • add a DisplayText property that return the same, and use DisplayMember
    • build a shim class for the data

    For the last:

    var data = cities.Select(city => new {
         Id = city.Id, Text = city.Name + " / " + city.Id }).ToList();
    cbo.ValueMember = "Id";
    cbo.DisplayMember = "Text";
    cbo.DataSource = data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have a website running a basic ASP.NET application that is mostly used from
I've got a (mostly) working plugin developed, but since its function is directly related
My ASP.NET application imports CSV files. They are mostly saved in spreadsheet or notepad
Not quite sure how to troubleshoot this. I'm maintaining an ASP site, its mostly
I mostly use lambda functions but sometimes use nested functions that seem to provide
I've managed to mostly ignore all this multi-byte character stuff, but now I need
I do mostly Java and C/C++ development, but I'm starting to do more web
I'm a vb.net developer in small IT department and I'm having trouble making the
I am primarily a Java and PHP developer and have some experience with .NET

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.