c# 对dataGridView内容判断

来源:百度知道 编辑:UC知道 时间:2024/06/04 03:30:12
if
(Convert.ToString(dataGridView[3,dataGridView1.CurrentCell.RowIndex].Value).Trim() = "在库")
{
textBox3.Text = Convert.ToString(dataGridView1[0,dataGridView1.CurrentCell.RowIndex].Value).Trim();
}
else
{
textBox3 .Text ="";
}
当选种行的第[3]的数据是 在库 的时候执行 将选种行第[0]的数据传到textbox里面!

我的语句不行! 应该怎么写啊!

if
(Convert.ToString(dataGridView.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value.Trim() = "在库")
{
textBox3.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value).Trim();
}
else
{
textBox3 .Text ="";
}

if
(Convert.ToString(dataGridView[3,dataGridView1.CurrentCell.RowIndex].Value).Trim() == "在库")

二位 为什么不写 == 呢