问题
I'm trying to add items to a combo box using a data table that already has some columns but I just want one of them values into the combo box. What i'm doing is this:
cbReviewers.DataSource = Reviewers_table.Columns[1];
but is not working, do you know how could I do it?
回答1:
I think you need to use Display and Value members properties to work with display data.
cbReviewers.DataSource = Reviewers_table
cbReviewers.DisplayMember = "ColumnNameThatContainsText"
cbReviewers.ValueMember = "ColumnNameThatContainsValue"
来源:https://stackoverflow.com/questions/46082802/how-to-fill-combobox-with-datatable-column-c-sharp