问题
This is the first time I've tried to use comboboxcolumn in a datagridview (WinForms, C#, EF4). With the designer, I created a datagridview to show the orders table, and inside the datagrid a comboboxcolumn to show the customer names from the customers table, this column has now the properties below:
Data:
DataPropertyName: CustomerID
DataSorce: customerBindingSource
DisplayMember: CompanyName
ValueMember: CustomerID
Design:
(Name): Cbo
ColumnType: DataGridViewComboBoxColumn
Then I entered the next code:
private void Form1_Load(object sender, EventArgs e)
{
nw = new NorthwindEntities();
testBindingSource.DataSource = nw.Orders;
}
When run the project, got the error message: "datagridviewcombocell is not a valid value". Please is there any advice on this, is there anything missing?
来源:https://stackoverflow.com/questions/10657095/comboboxcolumn-created-using-the-designer