tulio
asked on
Colors in a DBGrid control
Hi,
I need to set a color to a diferents rows, any idea how can I do that. I'll really apreciate your help.
I need to set a color to a diferents rows, any idea how can I do that. I'll really apreciate your help.
oops. obviously I switched the End If and next i statements.
ASKER
I tried to use this code and it change the entire color of the DBGrid background. I need to have diferents row colors depends on a criteria, for instance: All the rows whose CountryCode is "USA" in red and the rest in blue. If you have another solution please let me know ASAP. Thanks one more time for your cooperation.
If you are using the DBGrid that came with VB, you can't really do it - all the rows will be the same color.
If you need different rows in different colors, then you need the DBGrid Pro from Apex Software (www.apexsc.com), which allows you that and much, much more...
If you need different rows in different colors, then you need the DBGrid Pro from Apex Software (www.apexsc.com), which allows you that and much, much more...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
how about iterating through the recordset, and determining if it's an even or odd row. Then you can set the background color just for that row. e.g.
Dim rst as Recordset
Dim i as Integer
For i = 1 To rst.RecordCount
If (i Mod 2 = 0) Then
'set the background color
'I don't have VB on my home system so I don't know
'the syntax offhand for changing the background prop.
'of the row
next i
End if