|
-
Feb 20th, 2024, 08:42 PM
#4
Re: Populating a Combobox display/value of states from text file
When the Sorted property is True, it seems not to be honouring the DisplayMember based on that code. It seems to be displaying the result of calling ToString on each item rather than using the DisplayMember. I just tested with a custom type instead of a Tuple and got the type name in the control, which would be what you'd see if you hadn't set the DisplayMember. As a rule, you should always set the DataSource after the DisplayMember and ValueMember. There are often exceptions to rules though, and this is one such exception. If you set the DataSource first and then the DisplayMember and ValueMember, the data is displayed correctly. That goes for Tuples and custom types.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|