I have a combobox tied to a database. It loads CustomerNameLast as the display member and CustomerID as the Value Member.
Is it possible to have 2 display members shown? As in: CustomerNameLast, CustomerNameFirst (EG: Doe, John)
Printable View
I have a combobox tied to a database. It loads CustomerNameLast as the display member and CustomerID as the Value Member.
Is it possible to have 2 display members shown? As in: CustomerNameLast, CustomerNameFirst (EG: Doe, John)
No. There are examples in various places of extended ComboBoxes that add that functionality but the standard ComboBox class won't do it.
Why not have in your data adapter a query like:
Select CustomerID, LastName, FirstName, LastName + CHAR(9) + FirstName AS LNFN
From MyTable
Make LNFN as the display Member and keep CustomerID as your Value Member
It should then display
Doe Jane
Doe John
etc.
P.S. DOn't forget to generate the DataSet after making the change.
I just resorted to adding a column called CustomerName, which contains lastname and firstname: "Doe, John".