Comboboxcolumn created using the designer

对着背影说爱祢 提交于 2019-12-24 22:25:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!