PDA

Click to See Complete Forum and Search --> : Selecting entire colums in MSFlexGrid


nmretd
Jan 12th, 2000, 10:33 PM
I am using the following code to color all the cells in column 1 and 2. However, only the first two rows of columns 1 and 2 are changing color.

With MSFlexGrid1
.col = 1
.cellbackcolor = vbRed
.col = 2
.cellbackcolor = vbblue
End With

Can someone show me a method to color the entire 2 columns.

netSurfer
Jan 12th, 2000, 10:54 PM
you need to cycle through the rows.

for intI = 0 to MSFlexGrid1.rows -1
.row = inti

'do the col colors here
next inti

Aaron Young
Jan 12th, 2000, 10:58 PM
An easier method would be to set the RowSel property and also set the FillStyle Property to flexFillRepeat, ie.

Private Sub Command1_Click()
With MSFlexGrid1
.Row = 0
.Col = 1
.FillStyle = flexFillRepeat
.RowSel = .Rows - 1
.ColSel = 1
.CellBackColor = vbRed
.Col = 2
.ColSel = 2
.RowSel = .Rows - 1
.CellBackColor = vbBlue
.Col = 0
.FillStyle = flexFillSingle
End With
End Sub


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com

netSurfer
Jan 13th, 2000, 11:03 AM
Aaron, I didn't think of that. I forgot about the FillRepeat option. That would work way better.