本人返回结果集为:List<KeyValuePair<string, string>> list;
我将datatable传入子窗口,并绑定到datagridview中,然后要把单元格转换成下拉框的形式,并且将list数据源绑定到下拉框,求大神指点!

解决方案 »

  1.   

    遍历datatable即可,有什么问题!
      

  2.   


    datagridview.datasource = list;
    datagridview.databind();
      

  3.   


    帮定给datagridview中的 下拉框列表
      

  4.   

    我想要的是将 datagridview 的 DataGridViewTextBoxCell 转成DataGridViewComboBoxColumn 然后将List绑定给 DataGridViewComboBoxColumn
      

  5.   


    ((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).DataSource = list;
    ((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).ValueMember = "StuNum";
    ((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).DisplayMember = "StuName";
     
      

  6.   

    无法将类型为“System.Windows.Forms.DataGridViewTextBoxCell”的对象强制转换为类型“System.Windows.Forms.DataGridViewComboBoxCell”。
      

  7.   


    这个就可以啊, 你类型无法转换, 说明你选择的那个 CELL 不是 Combobox 列
      

  8.   

    你写的那列 是 DataGridViewTextBoxCell,不是DataGridViewComboBoxCell,请看清楚