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;

Can you please give me an advice in order to solve this?
Thank you

Its caused by passing an object to the datasource and not an actual value within the object.

Ie.

TextBox txtExample = new TextBox();
Console.WriteLine(txtExample.ToString()); //Outputs the literal textbox class to a string
Console.WriteLine(txtExample.Text); //Outputs the text field value

You need to ensure your not passing a class into the DG.

Thank you a lot. I've seen that if I override the class, then the problem disappears.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.