Jump to content
Xtreme .Net Talk

backgrounworker


Recommended Posts

Guest Vergassivellaunus
Posted

I inserted a backgroundworker form in my project.

 

My intention is to execute a long time evaluation without blocking the graphic interface.

 

These 2 routines should do the job:

 

Public Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted

 

End Sub

 

Public Sub BackgroundWorker1_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

x=math_evaluation() 'x is an array

End Sub

 

When math_evaluation is completed, RunWorkerCompleted should be triggered, but this does not happens.

 

If I use in dowork not a function but a sub, it works:

 

Public Sub BackgroundWorker1_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

math_evaluation()

End Sub

 

This is ok.

 

What is wrong?

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...