How to stop BackgroundWorker on Form's Closing event?

后端 未结 12 1886
春和景丽
春和景丽 2020-11-21 13:55

I have a form that spawns a BackgroundWorker, that should update form\'s own textbox (on main thread), hence Invoke((Action) (...)); call.
If in Handl

12条回答
  •  Happy的楠姐
    2020-11-21 14:24

    What about Me.IsHandleCreated?

        Private Sub BwDownload_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BwDownload.RunWorkerCompleted
        If Me.IsHandleCreated Then
            'Form is still open, so proceed
        End If
    End Sub
    

提交回复
热议问题