I run several Threads to check values in a database. When a thread is finished it writes back to its own label on the form. When all threads are finished, I would like to add the total of all those labels.
Not sure how to do that - how to tell when each is done.
I've attached the code for one function (one thread)... the only difference between this one and the others is the goc.GetConnection variable and the goc.theTextBox.
Thanks for your help!
TotalOrders.Text = CInt(hOrderCount.Text) + CInt(mOrderCount.Text) + CInt(gOrderCount.Text) + CInt(pOrderCount.Text)
Public Sub getHendersons()
lblHendersons.ForeColor = Color.White
Dim goc As New GetOrderArgs
goc.getConnection = HendersonConnectionString
goc.theTextBox = Me.hOrderCount
goc.startDelegate = AddressOf GetOrderCount
Dim t As New Thread(AddressOf goc.StartConnection)
threadCount += 1
t.Name = "Thread " & threadCount.ToString()
t.IsBackground = True