Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSFlexGrid Background for Cols...

Status
Not open for further replies.

kovas

Technical User
Aug 6, 2002
88
US
I am trying to set the background of Col 7 to red in every Row where value of Col 7 is 0 or less. I load the grid from a table and the number of rows is always different. How would I do this?

thanks!
 
this would set all col 7 to red, without checking for value after the grid is loaded. How would I do this while loading the grid when the number of rows is unknown yet. While doing the loop loading rows check for value of col 7 and then set the value of col 7 for the current row to Red.

grdSchedule.Row = 1
grdSchedule.Col = 7
grdSchedule.RowSel = grdSchedule.Rows - 1
grdSchedule.ColSel = grdSchedule.Cols - 1
grdSchedule.FillStyle = flexFillRepeat
grdSchedule.CellBackColor = vbRed


thanks!
 
Try this:

Dim lngCol As Long
Dim lngRow As Long
lngCol = 7
For lngRow = 0 To fg1.Rows - 1
fg1.Col = lngCol
fg1.Row = lngRow
Select Case Val(fg1.Text)
Case Is < 0
fg1.CellBackColor = vbRed
Case Else
fg1.CellBackColor = vbWhite
End Select
Next

This is sample code only - it has no error checking, but may get you started
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top