I keep getting confused about multithreading. I've used it once or twice before with the BackgroundWorker, but only with a kind of hack - I set CheckForIllegalCrossThread
Calls to False. Now I'm involved in a more important and complex project, and I don't think that option is appropriate for this issue.
The need for multithreading comes as usual from a UI screen freeze when a function is executed. However, I've been assigned the task of fixing *all* issues in the project that may benefit from multithreading. So, I need to become an expert pretty damn fast, like in the next 48 hours.
What I have to do, is use a different thread to call a data loading routine from an instance of a class that is external to the form I am in. When executing the function, I'll need to pass it a string parameter. eddObject is the external class; LoadData() is the method in that class I must call; szFileName is the string parameter I must pass. LoadData() returns an integer value as its result.
Current code snippet:
Dim IntResult as Integer = eddObject.LoadData(szFileN
ame)
If IntResult > 0 Then
... continue doing stuff
Example code is what I need to get through this, since I can't digest the articles out there on multithreading - they're either Hello World, or too complicated, or the English is bad. I just want to move execution of this one thing to another thread. My question is: How?
THANKS!
Start Free Trial