Y
yxq
Hello,
I want to abort a thread when form closed, but system will hang using the
code below sometimes.
*****************************************************
Private Sub frm1_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Closed
If ScanThread.ThreadState <> ThreadState.Stopped Then
ScanThread.Abort()
Do Until ScanThread.ThreadState = ThreadState.Stopped
Application.DoEvents()
Loop
End If
End Sub
I want to abort a thread when form closed, but system will hang using the
code below sometimes.
*****************************************************
Private Sub frm1_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Closed
If ScanThread.ThreadState <> ThreadState.Stopped Then
ScanThread.Abort()
Do Until ScanThread.ThreadState = ThreadState.Stopped
Application.DoEvents()
Loop
End If
End Sub