Jason
asked on
objectlistview changing text of cells
I need to change color of text
so if value of Cp is great than 1.5 the text is to be red otherwise text is to be black.
Can any one help as this code does not work
so if value of Cp is great than 1.5 the text is to be red otherwise text is to be black.
If Cp > 1.5 Then
Form1.ObjectListView1.Items(ic).SubItems(6).ForeColor = Color.Red
Else
Form1.ObjectListView1.Items(ic).SubItems(6).ForeColor = Color.Black
End If
Can any one help as this code does not work
ASKER
at the time it updates the listview
Sub ProcessMoneyGap()
For ic As Integer = 0 To Form1.ObjectListView1.Items.Count - 1
If ic <> Form1.ObjectListView1.Items.Count - 1 Then
Dim OldVal = Form1.ObjectListView1.Items(ic).SubItems(0).Text
Dim NewVal = Form1.ObjectListView1.Items(ic + 1).SubItems(0).Text
Dim CalcPercent
Dim Cp = Math.Round(((NewVal - OldVal) / OldVal) + 1, 2, MidpointRounding.AwayFromZero)
CalcPercent = Math.Round(((NewVal - OldVal) / OldVal * 100), 2, MidpointRounding.AwayFromZero)
Form1.ObjectListView1.Items(ic).SubItems(6).Text = Cp & " / " & CalcPercent
If Cp > 1.5 Then
Form1.ObjectListView1.Items(ic).SubItems(6).ForeColor = Color.Red
Else
Form1.ObjectListView1.Items(ic).SubItems(6).ForeColor = Color.Black
End If
End If
Next
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
saige that way doesn't fit with how i coded this process.
is there another way to do this that fits into the code i have written
is there another way to do this that fits into the code i have written
ASKER
Saige are you able to help with an alternative
ASKER
Potentially.
If possible, can you provide a copy of your current project with some valid test data. I can take a look at it this weekend.
-saige-
If possible, can you provide a copy of your current project with some valid test data. I can take a look at it this weekend.
-saige-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Saige is a great help
But with this one I solved myself to fit my existing code
But with this one I solved myself to fit my existing code
-saige-