Results 1 to 5 of 5

Thread: How to compare flexgrid colour value

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question 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


    VB Code:
    1. If Grid.CellBackColor) = vbRed Then
    2. msgbox "It is Red Colour",vbinformation    
    3. 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..........

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    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:
    1. With MSFlexGrid1
    2.    .Redraw = False
    3.    .FillStyle = flexFillRepeat
    4.    .Row = 1
    5.    .RowSel = .Rows -1
    6.    .Col = 1
    7.    .ColSel = .Cols -1
    8.    .CellBackColor = vbRed
    9.    .FillStyle = flexFillSingle
    10.    .Redraw = True
    11.    'Show cellbackcolor in (1,1)
    12.    .Row = 1
    13.    .Col = 1
    14.    MsgBox .CellBackColor
    15. End With

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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:
    1. Grid.Col = 2
    2. Grid.Row = 3
    3. If Grid.CellBackColor = vbRed Then
    4.     MsgBox "It is Red Colour",vbinformation    
    5. Else
    6.     '...
    7. End If

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    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:
    1. Grid.Col = 2
    2. Grid.Row = 3
    3. If Grid.CellBackColor = vbRed Then
    4.     MsgBox "It is Red Colour",vbinformation    
    5. Else
    6.     '...
    7. End If
    Did you try that? if the backcolor is not asigned with cellbackcolor, then there CellBackColor is always 0.

  5. #5

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to compare flexgrid colour value

    thanks all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width