Formatando DataGridView

private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.Value != null && e.ColumnIndex == 3)
{
//DataGridViewColumn col = dataGridView1.Columns[e.ColumnIndex];
for (int i = 0; i <= dataGridView1.Rows.Count - 2; i++)
{
if (Convert.ToDouble(dataGridView1.Rows[i].Cells[10].Value) < 6)
{
dataGridView1.Rows[i].Cells[10].Style.BackColor = Color.Red;
dataGridView1.Rows[i].Cells[10].Style.ForeColor = Color.White;
}
}
}
}

Comentários

Postagens mais visitadas deste blog

Funcão SQL para abreviar nomes

Função em JavaScript para consulta de CEP com retorno em XML ou Json