I think for displaying columns in combobox is responsible this string in Desingner of Form:
this.ComboBox1.DisplayMember = "name";
But, i cant add anything near “name”, combobox shows in all strings : System.Data.DataRowView
Maybe its wrong, tell me please how do this?
I’m just drag table as combobox from Data Source:
When Form Loading:
private void frmCheck_Load(object sender, EventArgs e)
{
this.ttzTableAdapter.Fill(this.dbDataSet.ttz, Convert.ToInt32(idFromWork.Text));
}
So combobox show, just “name” in list, i want that he show “number” and “name” in list.
"Convert.ToInt32(idFromWork.Text)"
parameter for show names where id_ttz(ID) = @idwork
DisplayMemberis a string specifying the name of an object property that is contained in the collection specified by the DataSource property. You cannot specify several properties to display. If you’ll try to do this, your ‘compound property’ will not be found, and objects will be displayed viaToString()implementation (thats why you seeSystem.Data.DataRowViewstring).If you need to display several properties of object, you can create custom multi-column combobox and implement it’s pop-up as ListView or DataGridView.
UPDATE: Instead of binding directly to DataTable of DataView, you can create your own anonymous type, which will provide formatted text for displaying: