I have a program in VB2008 and I need to execute a thread from differents Subs.
Each time I start the thread I want to cancel the previous.
Here an example:
Expand|Select|Wrap|Line Numbers
- Private Sub TextBox_Changed(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim ThreadResults As New Thread(AddressOf ShowResults)
- ThreadResults.Start()
- End Sub
- Private Sub ckBoxAllRecords_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
- Dim ThreadResults As New Thread(AddressOf ShowResults)
- ThreadResults.Start()
- End Sub
I check a checkbox, ckBoxAllRecords_CheckedChanged fires, thread spend 10 seconds filling a dataset.
I dont want anymore the dataset of TextBox_Changed so I want to cancel its filling.
It is possible to do?
Thanks in advance for any reply