I want to use a worker thread to do some long running process. I have tried the code below with no luck. What am I doing wrong?
[Public Delegate Sub firstDelegate
Public Delegate Sub secDelegate
Private Sub btnRecords_Click() Handles btnRecords.Click
Dim Start As New firstDelegate (AddressOf Me.allRecords)
Start.BeginInvoke(Nothing,Nothing)
End Sub
Private Sub sTimer()
'Show counter in the tBox
Do while i >= 0
txtBox1.Text=i
I += 1
Loop
End Sub
Private Sub allRecords()
'Schedule second timer to run and display the timer
Me.Dispatcher.BeginInvoke(DispatcherPriority.Normal, New secDelegate (AddressOf STimer))
'Processing happens here
'Thread.Sleep(20000)
End Sub]
'''''''''''''''''''''''''''''''''''''''''''''''''''''
The process does run but the tBox does not show the counter and UI still remains unresponsive. Can somebody assist me. Thanks a lot
[Public Delegate Sub firstDelegate
Public Delegate Sub secDelegate
Private Sub btnRecords_Click() Handles btnRecords.Click
Dim Start As New firstDelegate (AddressOf Me.allRecords)
Start.BeginInvoke(Nothing,Nothing)
End Sub
Private Sub sTimer()
'Show counter in the tBox
Do while i >= 0
txtBox1.Text=i
I += 1
Loop
End Sub
Private Sub allRecords()
'Schedule second timer to run and display the timer
Me.Dispatcher.BeginInvoke(DispatcherPriority.Normal, New secDelegate (AddressOf STimer))
'Processing happens here
'Thread.Sleep(20000)
End Sub]
'''''''''''''''''''''''''''''''''''''''''''''''''''''
The process does run but the tBox does not show the counter and UI still remains unresponsive. Can somebody assist me. Thanks a lot