Killing a thread when the application closes...
I have a threading that goes on forever so even when I close the application, it still remains in the memory.
I've tried
VB Code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim f As New Threading.Thread(AddressOf NewTime)
If f.IsAlive = True Then
MsgBox("thread f is alive")
ElseIf f.IsAlive = False Then
MsgBox("thread f is not alive")
f.Abort()
End If
End Sub
but it didn't work because it said that the thread was not alive.
So I guess I'll have to somehow refer to my existing dimmed thread... but how would I do that?
Thanks.