void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled && (null == e.Error)) { this.labelResult.Text = e.Result as String; } }
Monday, May 31, 2010
TargetInvocationException in BackgroundWorker class
To avoid TargetInvocationException exception in BackgroundWorker class, in BackgroundWorker.RunWorkerCompleted event handler don't access RunWorkerCompletedEventArgs.Result property in case of user cancellation or exception.
Subscribe to:
Post Comments (Atom)
Is that means use "e.Result as String" is ok?
ReplyDelete