I have 2 command buttons. CHECKALL and UNCHECKALL buttons. I'm changing my msglexgrid color to BLUE upon clicking CHECKALL button, and WHITE upon clicking the UNCHECKALL button using backcolor property. Simple, it's working fine.
Upon clicking the grid, "X" will be written on Column 0 of the selected row. It will also highlight the selected row (using cellbackcolor), so the identifier of the rows to be deleted are the "X" mark and the blue colored row.
Now, the backcolor property doesn't work on those columns previously marked/colored. The cellbackcolor is working perfectly but the backcolor is not. What i only want is to color the whole grid (all rows) with blue or white upon clicking CHECKALL & UNCHECKALL button.
Here's my code:
Code:
Private Sub grdCustomers_Click()
Dim intCol As Integer
intCol = 1
If grdCustomers.TextMatrix(grdCustomers.Row, 0) = "X" Then
grdCustomers.TextMatrix(grdCustomers.Row, 0) = ""
For intCol = 1 To 5
grdCustomers.Col = intCol
grdCustomers.CellBackColor = vbWhite
Next intCol
Else
grdCustomers.TextMatrix(grdCustomers.Row, 0) = "X"
For intCol = 1 To 5
grdCustomers.Col = intCol
grdCustomers.CellBackColor = &HFFFFC0
Next intCol
End If
End Sub
Code:
Private Sub cmdCheckAll_Click()
Dim intRec As Integer
intRec = 1
grdCustomers.FixedCols = 1
grdCustomers.ColAlignment(0) = 1
grdCustomers.BackColor = &HFFFFC0
For intRec = 1 To grdCustomers.Rows - 1
grdCustomers.TextMatrix(intRec, 0) = "X"
Next intRec
End Sub