首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# winform中datagridview的上拉框如何用,怎么绑定List数据源

2012-11-09 
C# winform中datagridview的下拉框怎么用,如何绑定List数据源本人返回结果集为:C# codeListKeyValuePair

C# winform中datagridview的下拉框怎么用,如何绑定List数据源
本人返回结果集为:

C# code
List<KeyValuePair<string, string>> list;

我将datatable传入子窗口,并绑定到datagridview中,然后要把单元格转换成下拉框的形式,并且将list数据源绑定到下拉框,求大神指点!

[解决办法]

((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).DataSource = list;
((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).ValueMember = "StuNum";
((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).DisplayMember = "StuName";
 
[解决办法]
探讨
((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).DataSource = list;
((DataGridViewComboBoxCell)dgvStudentList.Rows[0].Cells["Student"]).ValueMember = "StuNum";
((DataGridViewCombo……

热点排行