I am using currently the following code to populate a combobox:
combobox.DataSource = datatable;
combobox.DisplayMember = \"Auftragsnummer\";
combobox.ValueM
You can add to your dataset a dummy column (Description
) and use that as DisplayMember
in the combo box databinding.
SELECT Users.*, Surname+' '+Name+' - '+UserRole AS Description FROM Users
ComboBox.DataBindings.Add(new Binding("SelectedValue", bs, "ID"));
ComboBox.DataSource = ds.Tables["Users"];
ComboBox.DisplayMember = "Description";
ComboBox.ValueMember = "ID";
Simple and works.