Jason
asked on
Objectlistview how check checkboxes in bound data in listview for each row
I need help with objectlistview.
each row has 3 check boxes they are in columns 6, 7 , 8
If conditions are met I need the system to check the checkboxes
some instances non will be checked or 1 , 2 or all 3 could be checked depends what condition was met
the boxes are data bound
not very good with this control
each row has 3 check boxes they are in columns 6, 7 , 8
If conditions are met I need the system to check the checkboxes
some instances non will be checked or 1 , 2 or all 3 could be checked depends what condition was met
the boxes are data bound
not very good with this control
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Saige
Thanks again can work with that
Great
Cheers
Jason
Thanks again can work with that
Great
Cheers
Jason
ASKER
On thing RaceData not defines
ASKER
Having troubles tiring in the money gap process
Can you assist.
The process id dependent on the fWinOdds column being sorted before calculations being done
Here is my code
Can you assist.
The process id dependent on the fWinOdds column being sorted before calculations being done
Here is my code
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 Cp = Math.Round(((NewVal - OldVal) / OldVal) + 1, 2, MidpointRounding.AwayFromZero)
Dim CalcPercent = Math.Round(((NewVal - OldVal) / OldVal * 100), 2, MidpointRounding.AwayFromZero)
Form1.ObjectListView1.Items(ic).SubItems(6).Text = Cp '& " / " & CalcPercent
End If
Next
Dim count
For Each sb As OLVListItem In Form1.ObjectListView1.Items
If sb.SubItems(6).Text <> "" Then
If sb.SubItems(6).Text >= 1.5 Then
If count < 3 Then
sb.UseItemStyleForSubItems = False
sb.SubItems(6).ForeColor = Color.Red
count += 1
If count = 1 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightGreen
Next
ElseIf count = 2 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightSalmon
Next
ElseIf count = 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightSteelBlue
Next
ElseIf count <> 1 Or count <> 2 Or count <> 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.Transparent
Next
End If
ElseIf count <> 1 Or count <> 2 Or count <> 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.Transparent
Next
End If
Else
sb.UseItemStyleForSubItems = False
sb.SubItems(6).ForeColor = Color.Black
End If
End If
Next
End Sub
You need to change the properties of the object that the row is built from, not the fields/cells/columns in the row.
-saige-
-saige-
ASKER
I dont quiet understand
Could you give me an example
The problem im having is in order for me to calculate the gap or difference it needs to exist first for me to use.
Ie row (0) money gap need to know what the odds are for that row which is is easy but also that next row (1)
Could you give me an example
The problem im having is in order for me to calculate the gap or difference it needs to exist first for me to use.
Ie row (0) money gap need to know what the odds are for that row which is is easy but also that next row (1)
Ok, so then for example:
Sub ProcessMoneyGap()
For ic As Integer = 0 To ObjectListView1.Items.Count - 1
If ic <> ObjectListView1.Items.Count - 1 Then
Dim OldVal = CType(CType(ObjectListView1.Items(ic), OLVListItem).RowObject, RaceInfo)
Dim NewVal = CType(CType(ObjectListView1.Items(ic + 1), OLVListItem).RowObject, RaceInfo)
Dim Cp = Math.Round(((NewVal.WinOdds - OldVal.WinOdds) / OldVal.WinOdds) + 1, 2, MidpointRounding.AwayFromZero)
Dim CalcPercent = Math.Round(((NewVal.WinOdds - OldVal.WinOdds) / OldVal.WinOdds * 100), 2, MidpointRounding.AwayFromZero)
OldVal.MG = Cp '& " / " & CalcPercent
End If
Next
Dim count
For Each sb As OLVListItem In ObjectListView1.Items
If sb.SubItems(6).Text <> "" Then
If sb.SubItems(6).Text >= 1.5 Then
If count < 3 Then
sb.UseItemStyleForSubItems = False
sb.SubItems(6).ForeColor = Color.Red
count += 1
If count = 1 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightGreen
Next
ElseIf count = 2 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightSalmon
Next
ElseIf count = 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.LightSteelBlue
Next
ElseIf count <> 1 Or count <> 2 Or count <> 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.Transparent
Next
End If
ElseIf count <> 1 Or count <> 2 Or count <> 3 Then
For u = 0 To 10
sb.SubItems(u).BackColor = Color.Transparent
Next
End If
Else
sb.UseItemStyleForSubItems = False
sb.SubItems(6).ForeColor = Color.Black
End If
End If
Next
End Sub
-saige-
ASKER
Great thx
I am slowly understanding how to use this control
I am slowly understanding how to use this control
ASKER
Because the module does not know about the objects on the form. Thats why olv1WOdds has the squiggly line underneath it.
Probably because you are not modifying the underlying object that makes up the row.
-saige-
Probably because you are not modifying the underlying object that makes up the row.
-saige-
ASKER
solved the first one
any clue on the second one.
when i use the fwinodds tick appear in listview but if i change to fmg then objects in raceinfo indicated true value but the ticks dont appear on the screen.
what is funny is if i click on the true check box it activates all that were true for that row.
any help would be greatly appreciated
any clue on the second one.
when i use the fwinodds tick appear in listview but if i change to fmg then objects in raceinfo indicated true value but the ticks dont appear on the screen.
what is funny is if i click on the true check box it activates all that were true for that row.
any help would be greatly appreciated
ASKER
Saige
It appear that ticks dont work in checkboxes under a edit situation you have to call the entire process
It appear that ticks dont work in checkboxes under a edit situation you have to call the entire process
Check this sample, it will check the check-boxes based on the values in some column.
Open in new window
Open in new window
Open in new window