L
labjac
Guest
Hallo
I'm trying to change just Cell[8] on specific row base on result from below, but I can only find the property ofr the row colour and not the specific cell.
Any help will be much appreciated.
private void dgvProductionData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
foreach (DataGridViewRow Myrow in dgvProductionData.Rows)
{ //Here 2 cell is target value and 1 cell is Volume
if (Convert.ToDouble(Myrow.Cells[8].Value) < Convert.ToDouble(Myrow.Cells[7].Value))// Or your condition
{
Myrow.DefaultCellStyle.BackColor = Color.Red; //Just want to change Cell[7] colour
}
else
{
Myrow.DefaultCellStyle.BackColor = Color.Green; //Just want to change the Cell[7] colour
}
}
}
labjac
Continue reading...
I'm trying to change just Cell[8] on specific row base on result from below, but I can only find the property ofr the row colour and not the specific cell.
Any help will be much appreciated.
private void dgvProductionData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
foreach (DataGridViewRow Myrow in dgvProductionData.Rows)
{ //Here 2 cell is target value and 1 cell is Volume
if (Convert.ToDouble(Myrow.Cells[8].Value) < Convert.ToDouble(Myrow.Cells[7].Value))// Or your condition
{
Myrow.DefaultCellStyle.BackColor = Color.Red; //Just want to change Cell[7] colour
}
else
{
Myrow.DefaultCellStyle.BackColor = Color.Green; //Just want to change the Cell[7] colour
}
}
}
labjac
Continue reading...