VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



MSFlexGrid row colors

by HarvestR (5 Submissions)
Category: Coding Standards
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

This short SUB will allow you to set alternate colors in rows background of any MSflexGrid in your project. It will work with any number of rows and columns. (upgraded version of Raul Lopez submission).

Inputs
MSFlexgrid name, RGB values

Rate MSFlexGrid row colors

'Put this code in a .bas module
Public Sub MSFlexGridColors(ColorGrid As MSFlexGrid, R As Integer, G As Integer, B As Integer)
For j = 0 To ColorGrid.Cols - 1
  For i = 1 To ColorGrid.Rows - 1
    If i / 2 <> Int(i / 2) Then
      ColorGrid.Col = j
      ColorGrid.Row = i
      ColorGrid.CellBackColor = RGB(R, G, B)
    End If
  Next i
Next j
End Sub
'Then use this code to activat the SUB:
'(general: MSFlexGridColors MSFlexGrid, Red, Green, Blue)
MSFlexGridColors Form1.MSFlexGrid, 192, 255, 192
'I hope this can help you for your design

Download this snippet    Add to My Saved Code

MSFlexGrid row colors Comments

No comments have been posted about MSFlexGrid row colors. Why not be the first to post a comment about MSFlexGrid row colors.

Post your comment

Subject:
Message:
0/1000 characters