DataGridViewComboBoxColumn
如何在DataGridViewComboBoxColumn中动态绑定一个一维数组呢?比如说:
DataGridViewComboBoxColumn col_3 = new DataGridViewComboBoxColumn();
string[] str = new string[] { "是", "否" };
col_3.Name = field[0, 15];
col_3.HeaderText = field[1, 15];
col_3.ValueMember = field[0, 15];
col_3.DisplayMember = field[0, 15];
//col_3.DataPropertyName = field[0, 15];
this.dataGridView_System.Columns.Add(col_3);
col_3.DataSource = str;
这样好像不行 。请各位高手赐教! --------------------编程问答-------------------- DataGridViewComboBoxColumn dgvcbc = new DataGridViewComboBoxColumn();
dgvcbc.HeaderText = "C6";
string[] str = new string[] { "是", "否" };
dgvcbc.DataSource = str;
dataGridView1.Columns.Add(dgvcbc);
--------------------编程问答-------------------- 1楼是可行的. --------------------编程问答-------------------- --------------------编程问答--------------------
DataGridViewComboBoxColumn col_3 = new DataGridViewComboBoxColumn();--------------------编程问答-------------------- 代码上我看不出有什么问题,把field[0, 15]换成一个具体的值是可以正常运行的。
col_3.HeaderText = "XXX";
string[] str = new string[] { "是", "否" };
col_3.DataSource = str;
dataGridView1.Columns.Add(col_3);
比如:
DataGridViewComboBoxColumn col_3 = new DataGridViewComboBoxColumn();
string[] str = new string[] { "是", "否" };
col_3.Name = "name"
col_3.HeaderText = "是否";
col_3.ValueMember = null;
col_3.DisplayMember = null;
//col_3.DataPropertyName = field[0, 15];
this.dataGridView_System.Columns.Add(col_3);
col_3.DataSource = str;
楼主看一下是否问题出在了别的地方。
补充:.NET技术 , C#