DBGRID COM LINHA CIOLORIDA

CARDOZO 08/06/2012 15:39:15
#403800
Pessoal

Estou precisando fazer o seguinte

C arrego automaticamente um Dbgrid com banco de dados access e no BD tem um campo que se preenchido a linha do dbgrid deve ficar em vermelho, como fazer essa operação?

obridago
WIRCAO 13/03/2013 09:38:33
#420365
Olá Cardoso.

Sugestão:

Carrega os dados no flexgrid, ex:

RS.Open [Ô]SELECT * from NOME_TABELA order by CAMPO_TABELA asc[Ô], CON, adOpenStatic, adLockOptimistic
Do While Not RS.EOF
FGrid1.TextMatrix(FGrid1.Rows - 1, 1) = RS.Fields(0).Value
FGrid1.TextMatrix(FGrid1.Rows - 1, 2) = RS.Fields(1).Value
FGrid1.TextMatrix(FGrid1.Rows - 1, 3) = RS.Fields(2).Value
FGrid1.TextMatrix(FGrid1.Rows - 1, 4) = RS.Fields(3).Value
FGrid1.TextMatrix(FGrid1.Rows - 1, 5) = RS.Fields(4).Value
FGrid1.Rows = FGrid1.Rows + 1
RS.MoveNext
Loop
FGrid1.Rows = FGrid1.Rows - 1
[ô]Depois coloque esse código: ColorirGrid
[ô]Crie a sub abaixo:

Sub ColorirGrid()
Dim iL As Integer, iC As Integer
With FGrid1
For iL = 1 To .Rows - 1
For iC = 1 To .Cols - 1
.Col = iC
.Row = iL
If .TextMatrix(.Row, 4) = [Ô]DISPONÍVEL[Ô] Then
.CellBackColor = &H80FF80
ElseIf .TextMatrix(.Row, 4) = [Ô]MANUTENÇÃO[Ô] Then
.CellBackColor = &H8080FF
End If
Next iC
Next iL
End With
End Sub

Veja se te ajuda
Tópico encerrado , respostas não são mais permitidas