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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the color of an entire row of cells with the MSFlexGrid cntrl

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
VB Rookie here again,

Does anyone know how to change the color of an entire row of cells with the msflexgrid control?
 

If you've set the Selection mode to ByRow you can select the row and change the Selection Background Color:

Code:
Dim oldBackcolor As Long

oldBackcolor = fg.BackColorSel
fg.RowSel = fg.Row
fg.BackColorSel = RGB(255, 0, 0) ' change to red

'...do whatever and then set it back to original

fg.BackColorSel = oldBackcolor

Mark

 
Thanks a lot Mark,

I also found another way to do it by looping through each field(cell) as the grid is being populated and using the CellBackcolor property and the QBColor method to manipulate the color:
Code:
For x = 1 To rs.Fields.count - 1
     grd.Row = count  'count represents the row number
     grd.Col = x
     grd.CellFontBold = True
     grd.CellBackColor = QBColor(2)
Next
- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top