user interface - .Net: how can I have a combobox with multitple fields of its data source as Displaymember? -
How do I create a console with many areas of its data source without adding additional columns in my data source as your display member Can i do
I mean I want a combobox with displaymember with "id" + "-" "name".
1 - black
2 - white
3 - red
I do not want to add additional columns to my data source.
Thanks
is not bound to multiple properties (in WinForms). You must expand your DataTable
with a computed column and bind it with this new column.
dataTable.Column.Add ("IdAndName", typef (string), "id + name"); ComboBox.DataSource = DataTable; ComboBox.DisplayMember = "IdAndName";
Look for a reference to valid expressions for the calculated columns. You may have to use convert
.
dataTable.Columns.Add ("IdAndName", typef (string), "convert (id, 'system.String') + name");
Comments
Post a Comment