Click to See Complete Forum and Search --> : Grid and BackColor Change


Sameer Anand
December 13th, 1999, 12:01 PM
Can someone provide me with any tips where in I can change the BackColor of a row in a grid. As an example if there are ten rows displayed, I would like to see two different colors in backcolor alternating.

Thanks a million.

Chris Eastwood
December 16th, 1999, 07:38 AM
If you're using the FlexGrid, you can use code such as :


private Sub ColorBackGrid()

Dim lCount as Long

With MSFlexGrid1

.Redraw = false
.FillStyle = flexFillRepeat

for lCount = .FixedRows to .Rows - 1
.Col = .FixedCols
.Row = lCount
.RowSel = .Row
.ColSel = .Cols - 1
If .Row Mod 2 = 0 then
.CellBackColor = vbBlue
else
.CellBackColor = vbYellow
End If
next
.FillStyle = flexFillSingle
.Redraw = true
End With

End Sub





Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb