0
我试图操纵我的dataGridView来查看只有失败的人。如果他/她通过了特定的测试,它应该显示不令人满意的标记和Pass。操纵datagridView并按条件查看
我越来越和DataGridView的默认错误对话框
try
{
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
if ((int)dataGridView1.Rows[i].Cells[1].Value >= 50)
dataGridView1.Rows[i].Cells[1].Value = "Pass";
else if ((int)dataGridView1.Rows[i].Cells[2].Value >= 50)
dataGridView1.Rows[i].Cells[1].Value = "Pass";
else if ((int)dataGridView1.Rows[i].Cells[3].Value >= 50)
dataGridView1.Rows[i].Cells[1].Value = "Pass";
else if ((int)dataGridView1.Rows[i].Cells[4].Value >= 50)
dataGridView1.Rows[i].Cells[1].Value = "Pass";
}
}
catch (Exception err)
{
throw;
}
而不是改变/操纵在datagridview的数据,你应该改变它在数据表或datagridview的数据源。 – learningNew