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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:21:25+00:00 2026-05-20T09:21:25+00:00

I think I’ve stumbled upon a bug in the .NET (or the native windows

  • 0

I think I’ve stumbled upon a bug in the .NET (or the native windows API) concerning combo boxes.

I’ll give a specific scenario:

I have two database tables, with a one to many relation ship between the two, a brief description is as follows:

Table: FinSage
Column     Type
SageCode   nvarchar(10) (PK)
Desc       nvarchar(100)

Table: FinCode 
Column     Type 
FinCode    nvarchar(10) (PK) 
Desc       nvarchar(100) 
SageCode   nvarchar(10) (FK)

These are entirely user maintained, with only the PK obviously being constrained to be unique. When creating or editing a record on the FinCode table I have a combobox on the screen which has the display member bound to the ‘Desc’ column and the value member bound to SageCode.

The problem arises when there are duplicate entries in the ‘Desc’ column, which is quite common under the expected use of the system. It seems the .net combo boxes does a reverse lookup using the display value to get the value member. So when the combo box gains focus it will change the value to the first occurrence of the display member.

I understand that in theory, if there are duplicates in the display value then the combo box effectively has no use as the user doesn’t know which value they have selected. However as we know users are not perfect and so they will and do enter the same descriptive value for a code.

I currently get around this by combining the code and the description, however my boss wants them to be able to edit this value by using either the code or the description (as some uses prefer to use one or the other). I tried using two combo boxes bound to the same binding source but saw this problem arise.

Apologies for the verbose description, its not really a problem that can be summed up in code.

On a slightly related note, the combo boxes that Access use don’t have this bug. But I believe Access is comparable to WPF in that it draws all its own UI components rather than using the Win32 API.

Is there not a way of ‘forcing’ a native combo box to find the correct item in the list based on the associated value or was the concept of value-description pair developed after Microsoft designed their native combo box?

Thank you for any insights

Marlon

*edit*
The answer below prompted me to quickly dev up a test application and I’m not getting the same behaviour unless the combobox is inside a datagridview (which is unrelated to the original question).

Sorry Microsoft, I would delete this question but I cant now, ah well, mistakes are good.

  • 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-20T09:21:26+00:00Added an answer on May 20, 2026 at 9:21 am

    ComboBoxes and ListBoxes do have value-description pairs in the form value(index)-Description(text).

    Therefore if the combobox includes to of the same description they are still unique as they don’t have the same index.

    I’d say rather than there being a bug in .net there’s a bug in your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is specific to IE 6.0 but... In JavaScript I add a
I think the file that is produced is an .asm file, any idea how
I think most people know how to do this via the GUI (right click
I think most people here understand the importance of fully automated builds. The problem
I think it can be done by applying the transformation matrix of the scenegraph
I think that java executables (jar files) are trivial to decompile and get the
I think I've got it down to the most basic case: int main(int argc,
I think I know how to handle this case, but I just want to
I think title should be good enough.
I think this is a multi-part question, so bear with me. Currently all of

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.