How to compare flexgrid colour value
I am using a flex grid
i Want that if flexgrid cell colour =red then it show that it is red colour but how it is possible.........
Any idea :sick:
VB Code:
If Grid.CellBackColor) = vbRed Then
msgbox "It is Red Colour",vbinformation
End If
problem is thatit is showing value of gridbackcolor=0 but vbred value=255 there is alredy flexgrid is in red colour............
help me..........
Re: How to compare flexgrid colour value
You have to assign the backcolor using MSFlexGrid1.CellBackColor = VbRed, then get it with MSFlexGrid1.CellBackColor. If you select a backcolor in design mode, it won't work when using MSFlexGrid1.CellBackColor to show that color. So simply make a selection, and assign a color..
VB Code:
With MSFlexGrid1
.Redraw = False
.FillStyle = flexFillRepeat
.Row = 1
.RowSel = .Rows -1
.Col = 1
.ColSel = .Cols -1
.CellBackColor = vbRed
.FillStyle = flexFillSingle
.Redraw = True
'Show cellbackcolor in (1,1)
.Row = 1
.Col = 1
MsgBox .CellBackColor
End With
Re: How to compare flexgrid colour value
it doesn't matter when color was assigned (design or runtime) - the trick is to explicitly navigate to cell you need (set row/col) before calling any of the cell's properties (color, font, etc):
VB Code:
Grid.Col = 2
Grid.Row = 3
If Grid.CellBackColor = vbRed Then
MsgBox "It is Red Colour",vbinformation
Else
'...
End If
Re: How to compare flexgrid colour value
Quote:
Originally Posted by RhinoBull
it doesn't matter when color was assigned (design or runtime) - the trick is to explicitly navigate to cell you need (set row/col) before calling any of the cell's properties (color, font, etc):
VB Code:
Grid.Col = 2
Grid.Row = 3
If Grid.CellBackColor = vbRed Then
MsgBox "It is Red Colour",vbinformation
Else
'...
End If
Did you try that? if the backcolor is not asigned with cellbackcolor, then there CellBackColor is always 0.
Re: How to compare flexgrid colour value