on 2021 Dec 16 8:23 AM
I have a user form with a grid containing 2000 rows,
When the data is loaded certain Cells need to be colored either Red or Green depending on their value.
The performance is absolutely abysmal (takes about 30 seconds to load )
the code I am using is as follows:
Private Sub colorAllPlanQtyRows()
For i = 0 To planGrid.Rows.Count - 1
planGrid.CommonSetting.SetCellFontColor(i + 1, 11, getPlanQuantityValidationColour(i))
Next
End Sub
Private Function getPlanQuantityValidationColour(row As Integer) As Integer
Dim reqQty As Integer = dtPlan.GetValue("RequiredQuantity", planGrid.GetDataTableRowIndex(row))
Dim planQty As Integer = dtPlan.GetValue("PlanQuantity", planGrid.GetDataTableRowIndex(row))
If planQty < reqQty Then
Return red
Else
Return green
End If
End Function
Are there any alternative methods for coloring multiple cells without the overhead of looping the entire grid?
Thank you
User | Count |
---|---|
109 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.