I have three data processing routines which I want to run in threads so that they don’t clog up the UI. How can I halt execution of thread until prior thread completes successfully.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Link tables.
'Spin off a new thread.
t1 = New Thread(New ThreadStart(AddressOf CreateLinks))
t1.IsBackground = True
t1.Start()
Select Case True
Case optRawFigures.Checked
'Spin off a new thread.
t2 = New Thread(New ThreadStart(AddressOf GetFigures))
t2.IsBackground = True
t2.Start()
Case optAverage.Checked
'Spin off a new thread.
t3 = New Thread(New ThreadStart(AddressOf CalculateFigures))
t3.IsBackground = True
t3.Start()
End Select
End Sub
Apparently thread t1 is executed on button click along with one of the threads from Select Case. This leads to error because tables need to be linked before any data processing job can be done.
I want t1 to execute and when it is completed successfully it should execute Select Case.
Also, how can I debug the routine which runs off a thread.
Thanks
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Link tables.
'Spin off a new thread.
t1 = New Thread(New ThreadStart(AddressOf CreateLinks))
t1.IsBackground = True
t1.Start()
Select Case True
Case optRawFigures.Checked
'Spin off a new thread.
t2 = New Thread(New ThreadStart(AddressOf GetFigures))
t2.IsBackground = True
t2.Start()
Case optAverage.Checked
'Spin off a new thread.
t3 = New Thread(New ThreadStart(AddressOf CalculateFigures))
t3.IsBackground = True
t3.Start()
End Select
End Sub
Apparently thread t1 is executed on button click along with one of the threads from Select Case. This leads to error because tables need to be linked before any data processing job can be done.
I want t1 to execute and when it is completed successfully it should execute Select Case.
Also, how can I debug the routine which runs off a thread.
Thanks