C# 判断datagridview列值 改变整行颜色
C#判断datagridview列值改变整行颜色我的代码 privatevoidbutton1_Click(objectsender,E...
C# 判断datagridview列值 改变整行颜色我的代码 private void button1_Click(object sender, EventArgs e) { DataSet ds = InventoryConvert.order8(); this.dataGridView1.DataSource = ds.Tables["tb"].DefaultView; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { int dt = Convert.ToInt32(ds.Tables[0].Rows[i][3].ToString()); if (dt < 10) { this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red; } else { this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.White; } } }
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询