Use Barrier.
To wait for all threads to be completed, define a global barrier:
Dim barr As New Threading.Barrier(1)
Add participant before starting threads:
Sub startathread()
barr.AddParticipant()
Dim t As New Threading.Thread(AddressOf blabla)
t.Start()
End Sub
As the job is done, signal that it is done:
Sub blabla()
'do stuff
barr.SignalAndWait()
End Sub
Now the function starting all threads and waiting for all to be completed:
Sub x()
For i = 0 To 9
startathread()
Next
barr.SignalAndWait()
'from this line on, all the threads are completed their jobs.
End Sub
For sorting, your thread must add each data to a list:
Dim datalist As New List(Of String)
Sub Progress(Data)
datalist.Add(Data.ToString)
End Sub
When addition of all data is done a function to sort and place them must be called:
Sub SortAndPlace()
datalist.Sort()
For Each sdata In datalist
Dim g As New Grid
'Pretty Up Grid
Dim l As New Label
'Pretty Up Label
l.Content = sdata
g.Children.Add(l)
WrapPanel1.Children.Add(g)
Next
End Sub