怎么动态的用语言给datagridview的combobox列中的很多单元格添加数据?比如datagridview有一列combobox,该列总共有10行(也就是有10个combobox);我现在要将第一行的combobox添加“123”,第二个添加“123”和“456”,依次类推, 怎么搞??
问题二:第一次添加完了之后,如果我要利用一个控件(按钮等)来更新那列combobox的内容,需不需要另外定义什么东西?? 类似于refresh??
请教了
问题二:第一次添加完了之后,如果我要利用一个控件(按钮等)来更新那列combobox的内容,需不需要另外定义什么东西?? 类似于refresh??
请教了
int rowInd=datagridview1.Rows.Add(item);
string[] options=new string[]{"选项一","选项二"}
DataGridViewComboBoxCell comboBoxCell=new DataGridViewComboBoxCell();
comboBoxCell.Items.AddRange(options);
this.datagridview1["options",rowInd]=comboBoxCell;
2、重新绑定资源即可刷新,应该没有直接刷新的函数
我怎么把“123”作为string拿出来用呢?
DataGridViewComboBoxCell comboBoxCell = this.dataGridView1["options", 0] as DataGridViewComboBoxCell;
string text = comboBoxCell.Value.ToString();//取选中项的值
comboBoxCell.Items //取所有项