如何让每一行的DataGridViewComboBoxColumn值不一样 如果某列的值为0时,combobox的值为1,2,3如果某列的值为1时,combobox的值为4,5,6 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 绑定之后,判断设定就OK。 private void Form1_Load(object sender, EventArgs e) { var list = new[] { new { id = "123", code = "1" }, new { id = "124", code = "2" }, new { id = "125", code = "2" }, new { id = "126", code = "1" }, }; this.dataGridView1.DataSource = list; var col = new DataGridViewComboBoxColumn(); col.HeaderText = "ComboxCol"; this.dataGridView1.Columns.Add(col); foreach (DataGridViewRow row in this.dataGridView1.Rows) { var comboBox = (DataGridViewComboBoxCell)row.Cells[2]; if (row.Cells[1].Value.ToString() == "1") comboBox.DataSource = new[] { "a", "b", "c" }; else comboBox.DataSource = new[] { "1", "2", "3" }; } } 关于代码中的product? C# 屏幕坐标 高手帮我看看! 流. 没分了,人民币请人解决个问题,高手来 C#之家 pingyan 我把图片存到ORACLE的LONG RAW字段中,请问如何提取出来将图片显示在WEB 页上,急等,最好有代码 SQL存储过程,这个字符串怎么拼接哈?菜鸟求助. 在用C# Windos Form 通过调用新浪的网页来实现短信发送功能时,在发送中文时不能发送成功,为什么 datagridview异步委托如何实现? c# treeview问题,请高手帮忙!急急!
{
var list = new[]
{
new { id = "123", code = "1" },
new { id = "124", code = "2" },
new { id = "125", code = "2" },
new { id = "126", code = "1" },
};
this.dataGridView1.DataSource = list;
var col = new DataGridViewComboBoxColumn();
col.HeaderText = "ComboxCol";
this.dataGridView1.Columns.Add(col);
foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
var comboBox = (DataGridViewComboBoxCell)row.Cells[2];
if (row.Cells[1].Value.ToString() == "1")
comboBox.DataSource = new[] { "a", "b", "c" };
else
comboBox.DataSource = new[] { "1", "2", "3" };
}
}