pvg1975
asked on
vb.net multithreading
Hi All!
I have to run a very time consumming process and I thought about putting that piece of code inside a backgroundworker. Is this the right way to do multithreading?
Also, how do I make the code inside the backgroundworker run?
Thanks
I have to run a very time consumming process and I thought about putting that piece of code inside a backgroundworker. Is this the right way to do multithreading?
Also, how do I make the code inside the backgroundworker run?
Thanks
ASKER
I saw those examples, but when I try to call the code as:
backgroundworker1.dowork()
I get the following error:
Public Event DoWork(sender As Object, e As System.ComponentModel.DoWo rkEventArg s)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
I just need to know how to call and run the code inside backgroundworker1
Thanks
backgroundworker1.dowork()
I get the following error:
Public Event DoWork(sender As Object, e As System.ComponentModel.DoWo
I just need to know how to call and run the code inside backgroundworker1
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all for the answers :)))
Not even an assist?
ASKER
I know I screwed it up after I assigned the points :(
Im sorry about that Stick, I clicked on the email and toke me straight to yv989c answer.
Will press more attention next time.
Im sorry about that Stick, I clicked on the email and toke me straight to yv989c answer.
Will press more attention next time.
You can always select to "Request Attention" and have the split performed by a moderator.
ASKER
Done :)
Oh, I just answered to your question based on your error, but strickdd gave a detailed information about how to work with the BackgroundWorker class, answering that too, and he pressed the submit button before me ;)
If the process has multiple tasks which can be run in parallel, each of these processes should be set as a backgroundworker thread.
A decent example of using BackgroundWorker can be found at
http://msdn.microsoft.com/en-us/library/8xs8549b.aspx
http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx#Y126