Hi all,
I am newbie in c# and i have a question regarding DataGridView
I have a Table with 3 Columns
(0)IdLeggiSeriale <Is Primary key>
(1)ValoreSeriale <Is Integer>
(2)DataAcquisizione <Is DateTime>
I will like to change the color of each row that
in the in column(1) "ValoreSeriale" the Value is greater than 50.
private void dataGridView1_CellFormatting(object sender,
DataGridViewCellFormattingEventArgs e)
{
if
(dataGridView1.Columns[e.ColumnIndex].Name.Equals("ValoreSeriale"))
{
Int32 intValue;
if (Int32.TryParse((String)e.Value, out intValue) &&
(intValue 50))
{
e.CellStyle.BackColor = Color.Yellow;
e.CellStyle.SelectionBackColor = Color.DarkRed;
}
}
}
In the Above code i only change the color a singular cell.
How can i change all the row.
Thanks
Marco