#Region "RunnerPoolDristrabution"
Private poollist As New ArrayList
Public Sub RunnerDistrabution()
Dim i As Decimal = 0
Dim ipool As Decimal = 0
Dim q As Decimal = 0
Dim count As Integer = 0
For Each item As ListViewItem In ListView7.Items
i = (winpool - ipool) / CDec(item.SubItems(1).Text)
item.SubItems(8).Text = (i + (0.2 * i)).ToString("N2")
If poollist(count).ToString <> item.SubItems(8).Text Then
poollist. ((i + (0.2 * i)).ToString("N2"))
End If
ipool = ipool + i
count += 1
Next
For Each item As ListViewItem In ListView7.Items
q = CDec(item.SubItems(8).Text)
item.SubItems(9).Text = (i + (0.2 * i) - CDec(q)).ToString("N2")
Next
End Sub
#End Region
Dim poollist As New ArrayList ' this saves the poollist before clearing
Dim varlist As New ArrayList ' this saved the variance before clearing
first = 0
second = 0
third = 0
Div = 0
Countdown()
If finished = True Then
Exit Sub
End If
Try
'Log("Step1")
If OddsDisplayActive = True Then
For Each item As ListViewItem In ListView7.Items
If item.SubItems(8).Text <> "" Then
poollist.Add(item.SubItems(8).Text)
If item.SubItems(9).Text <> "" Then
varlist.Add(item.SubItems(9).Text)
End If
End If
Next
ClearListviews(3)
TryAgain:
tabUri = SelectedRace
If Uri.TryCreate(tabUri, UriKind.Absolute, apiUri) = True Then
result_post = SendRequest(apiUri)
Try
[subtitle]TabRace = serializer.Deserialize(Of TAB.Race)(result_post)[/subtitle] ' this is where race data is imported
'Log("step2")
Catch
UpdateToken()
Log("Token Change")
Thread.Sleep(100)
GoTo TryAgain
End Try
Dim decimal1 As Decimal = New Decimal(TabRace.pools(5).poolTotal.Value)
winpool = New Decimal(TabRace.pools(0).poolTotal.Value)
winpool = winpool - (0.145 * winpool)
SetRaceLabelText(Label125, "$" & winpool.ToString("0.00"), "Label125")
decimal1 = decimal1 - (0.21 * decimal1) 'This is where TAB Take removed fron pool
SetRaceLabelText(Label107, TabRace.pools(5).poolStatusCode, "Label107")
betstatus = TabRace.pools(5).poolStatusCode
SetRaceLabelText(lblTriPool, "$" & decimal1.ToString("0.00"), "lblTriPool")
TriPool = decimal1.ToString("0.00")
SetRaceLabelText(Label30, TabRace.raceStatus, "Label30")
For Each runner As TAB.runners In TabRace.runners
Dim DisplayOdds As Double = runner.parimutuel.returnWin
If DisplayOdds <> 0 Then
Dim NewRunner As ListViewItem = ListView7.Items.Add(runner.runnerNumber.ToString)
NewRunner.SubItems.Add(DisplayOdds.ToString("0.00"))
NewRunner.SubItems.Add("")
NewRunner.SubItems.Add("")
NewRunner.SubItems.Add("")
NewRunner.SubItems.Add(False) ' check1
NewRunner.SubItems.Add(False) ' check2
NewRunner.SubItems.Add(False) ' check3
NewRunner.SubItems.Add("")
NewRunner.SubItems.Add("")
End If
Next
If ListView7.Items.Count <> lv7count Then
ListView7.Controls.Clear()
addboxes = True
lv7count = ListView7.Items.Count
End If
If addboxes Then
AddChkBoxes(ListView7.Items.Count)
End If
'Log("step3")
If TabRace.dividends IsNot Nothing Then
For i = 0 To TabRace.dividends.Count - 1
If TabRace.dividends(i).wageringProduct = "Trifecta" Then
first = TabRace.dividends(i).poolDividends(0).selections(0)
second = TabRace.dividends(i).poolDividends(0).selections(1)
third = TabRace.dividends(i).poolDividends(0).selections(2)
Div = TabRace.dividends(i).poolDividends(0).amount
End If
Next
End If
End If
'Log("step3a")
End If
'Log("step4")
Dim num1 As Integer = 1
ListView7.ListViewItemSorter = New ListViewComparer(num1, System.Windows.Forms.SortOrder.Ascending)
ProcessMoneyGap()
CheckBoxState()
If ListView7.Items.Count <> 0 Then
getRules()
PercPool()
RunnerDistrabution(poollist, varlist)
If Button1.Text = "Automatic" Then
chkBetSystem()
ElseIf Button1.Text = "Manual" Then
End If
If Not lv3Focus Then
ComboCalcs()
End If
getRaceResults(first, second, third, Div)
End If
ChkRaceStatus()
'Log("step5")
Catch ex As Exception
Log(ex.ToString)
End Try
myTimer_Main.Dispose()
StartMain(True)
End Sub
Why is the ListView being cleared? Why not just update the ListView every three seconds? That way you already have the old value stored and can do all the calculations and then update with the new values.