2009-11-11 7 views
0

DataGridView에서 특정 행을 강조 표시하려고합니다.DataGridView에서 행을 강조 표시 할 수 없습니다.

그러나 다음과 같은 코드가 작동하지 않습니다 :

foreach (DataGridViewRow row in DataGridView1.Rows) 
{ 
    if (row.Cells["Job No"].Value.ToString().Equals("Sub Total")) 
    { 
     row.DefaultCellStyle.BackColor = Color.Red;      
    } 
} 

어떤 아이디어? 감사!

+0

what prog language ?? – Treby

+0

이 코드에 C#을 사용하고 있습니다. – aioria

답변

0
foreach (DataGridViewRow row in DataGridView1.Rows) 
{ 
    if (row.Cells["Job No"].Value.ToString().Equals("Sub Total")) 
    { 
     DataGridView1.rows[row.index].DefaultCellStyle.BackColor = Color.Red; 
    } 
} 
관련 문제