I would like to know if you have any way to color the row in the datagridview without using a loop.
I have a minimum stock and when available is below the minimum I would paint the red line.
Ididitthatway,butitgotreallyslow.
for(inti=0;i<dgvEstoque_pecas.RowCount-1;i++){intdisponivel=0,minimo=0;if(dgvEstoque_pecas.Rows[i].Cells["disponivel"].Value.ToString() != "")
{
disponivel = Convert.ToInt32(dgvEstoque_pecas.Rows[i].Cells[disponivel].Value.ToString());
}
else
{
disponivel = 0;
}
if (dgvEstoque_pecas.Rows[i].Cells["minimo"].Value.ToString() != "")
{
minimo = Convert.ToInt32(dgvEstoque_pecas.Rows[i].Cells["minimo"].Value.ToString());
}
else
{
minimo = 0;
}
if (disponivel < minimo)
dgvEstoque_pecas.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}