Code Q & A
  • index
  • Java
  • python
  • javascript
No Result
View All Result
Code Q & A
  • index
  • Java
  • python
  • javascript
No Result
View All Result
Code Q & A
No Result
View All Result

Qualified type displayed in combobox instead of property value

06/23/2022
in c#, combobox, winforms
Reading Time: 1 min read

I have a problem with my combobox.
I've set DataSource which contains a list of objects, DisplayMember and also ValueMember but there are times when the combobox displays the namespace where the object class is placed. For example: Project.Interface.Object

cmbAuto.DataSource = Collections.ProfileList.FindAll(t => t.IsAuto);
cmbAuto.DisplayMember = "Name";
cmbAuto.ValueMember = "ID";
cmbAuto.SelectedIndex = -1; 

I suggets you to use Where operator

cmbAuto.DataSource = Collections.ProfileList.Where(t => t.IsAuto);

Nota : FindAll() is a function on the List type, it's not a LINQ extension method like Where.

I've solved the problem by overriding ToString method of the object.

Tags: c#comboboxwinforms
ShareTweetPin

Related Posts

asp.net

Websocket client not connecting to websocket server

I have a NET Core 3.1 API in which I create a websocket server and start it when the API...

.net-core

Pinging Websocket server with Websocket .NET client

I'm trying to figure out how to send ping/pong heartbeats in order to be sure to maintain a connection with...

asp.net

An invalid character was found in the mail header: ';'

error on this line "message.To.Add(strCommandText);" when I try to take the email data from the database to send an email....

asp.net-core

ASP.NET Core return JSON with status code

I'm looking for the correct way to return JSON with a HTTP status code in my .NET Core Web API...

Next Post

SelectedValue for ComboBox not getting set

Hot tags

.htaccess .net Algorithm amazon-web-services android Apache c# css c语言 django django-models docker google-app-engine google-cloud-platform hadoop Hive html ios java javascript kubernetes linux macos maven mysql node.js php postgresql python python-2-7 Python 3.X R ruby ruby-on-rails spring SQL SQL SERVER svn TensorFlow ubuntu windows xcode 爬虫 算法 编程语言

    © 2022 Websitedic.com.

    No Result
    View All Result
    • index
    • Java
    • python
    • javascript