DataGridView Combobox列错误

时间:2011-05-18 15:54:23

标签: c# database datagridview combobox

我有数据表雇员vith字段:

employe_id

名称

boss_id,带有employees_id的递归

当我创建组合框列时它显示了值,但是当我尝试打开它时,它显示错误:对象引用未设置为对象的实例。这是我的代码:

DataGridViewComboBoxColumn cbemploye = new DataGridViewComboBoxColumn();
        cbemploye.HeaderText = "Boss";
        cbemploye.DataSource = employe;
        cbemploye.DisplayMember = "surname";
        cbemploye.ValueMember = "employe_id";
        cbemploye.DataPropertyName = "boss_id";
        this.DGV_Employe.Columns[6].Visible = false;
        this.DGV_Employe.Columns.Insert(6, cbemploye);

0 个答案:

没有答案