CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Posts
    2

    Grid and BackColor Change

    Can someone provide me with any tips where in I can change the BackColor of a row in a grid. As an example if there are ten rows displayed, I would like to see two different colors in backcolor alternating.

    Thanks a million.


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Grid and BackColor Change

    If you're using the FlexGrid, you can use code such as :


    private Sub ColorBackGrid()

    Dim lCount as Long

    With MSFlexGrid1

    .Redraw = false
    .FillStyle = flexFillRepeat

    for lCount = .FixedRows to .Rows - 1
    .Col = .FixedCols
    .Row = lCount
    .RowSel = .Row
    .ColSel = .Cols - 1
    If .Row Mod 2 = 0 then
    .CellBackColor = vbBlue
    else
    .CellBackColor = vbYellow
    End If
    next
    .FillStyle = flexFillSingle
    .Redraw = true
    End With

    End Sub





    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured