且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在绑定的Datagridview中添加和填充DataGridViewComboBoxcolumn

更新时间:2023-10-14 11:51:52

您正在设置 DataPropertyName 错误。您将一个列表绑定到网格,将一个列表绑定到列。 DisplayMember ValueMember 是列名/绑定到该列的项目的属性。 DataPropertyName 是绑定到网格的项目的列/属性的名称。就您而言,在我看来 DataPropertyName 应该设置为 Condition。

You're setting the DataPropertyName incorrectly. You bind one list to the grid and one to the column. The DisplayMember and ValueMember are names of columns/properties of the items bound to the column. The DataPropertyName is the name of a column/property of the items bound to the grid. In your case, it looks to me like DataPropertyName should be set to "Condition".