1
I have a Windows Form that carries a DataGridView
, in it has a column that contains positive and negative values, need that when the value of this column is negative the row is a different color.
How can I do that?
follows the Code:
private void ListaGrid()
{
string strSQL = @"SELECT
SA.A1_COD AS CODIGO,
SA.A1_NOME AS CLIENTE,
SA.A1_LC AS [LIMITE CREDITO],
SUM(SE.E1_VALOR) AS [TOTAL COMPRA],
SUM(SE.E1_SALDO) AS [SALDO ABERTO],
SA.A1_LC - SUM(SE.E1_SALDO) AS [SALDO LIMITE]
FROM SA1010 AS SA
INNER JOIN SE1010 AS SE WITH (NOLOCK) ON SA.A1_COD = SE.E1_CLIENTE
WHERE SA.D_E_L_E_T_ <> '*' AND SE.D_E_L_E_T_ <> '*'
GROUP BY SA.A1_COD, SA.A1_NOME, SA.A1_LC
ORDER BY CODIGO";
comando = new SqlCommand(strSQL, conm);
try
{
SqlDataAdapter dados = new SqlDataAdapter(comando);
DataTable dtLista = new DataTable();
dados.Fill(dtLista);
DGW_LimiteCredito.DataSource = dtLista;
}
catch
{
MessageBox.Show("Não existem dados a serem encontrados");
}
}
While it’s readable what you’ve done, consider leaving an explanation.
– LP. Gonçalves
@LP.Gonçalves It’s true, I left explained.
– MurariAlex
Thank you very much gave it right here.
– Junior Guerreiro