D
DrLargePants
If I have something like below, and I catch an error in DoWork, how do
I then get e.Error in RunWorkerCompleted to populate ?
Private Sub bg_DoWork(ByVal sender As Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles _downloadWorker.DoWork
Try
e.Result = SomeLongRunningTask
Catch ex As Exception
e.Result = ex
End Try
End Sub
Private Sub bg_RunWorkerCompleted(ByVal sender As Object, ByVal e
As System.ComponentModel.RunWorkerCompletedEventArgs) Handles
_downloadWorker.RunWorkerCompleted
If e.Error IsNot Nothing Then
MsgBox(e.Error.Message)
Else
If e.Cancelled Then
MsgBox("Cancelled")
Else
MsgBox("Done")
End If
End If
End Sub
I then get e.Error in RunWorkerCompleted to populate ?
Private Sub bg_DoWork(ByVal sender As Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles _downloadWorker.DoWork
Try
e.Result = SomeLongRunningTask
Catch ex As Exception
e.Result = ex
End Try
End Sub
Private Sub bg_RunWorkerCompleted(ByVal sender As Object, ByVal e
As System.ComponentModel.RunWorkerCompletedEventArgs) Handles
_downloadWorker.RunWorkerCompleted
If e.Error IsNot Nothing Then
MsgBox(e.Error.Message)
Else
If e.Cancelled Then
MsgBox("Cancelled")
Else
MsgBox("Done")
End If
End If
End Sub