Advertisement

03.27.2008 at 12:47PM PDT, ID: 23275392
[x]
Attachment Details

Multithreading a function with parameters

Asked by k3n51mm in .NET, Microsoft Visual Basic.Net, .NET Framework 2.0

Tags: VB.Net 2005

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 CheckForIllegalCrossThreadCalls 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(szFileName)
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
 
 
[+][-]03.27.2008 at 02:00PM PDT, ID: 21225713

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 02:14PM PDT, ID: 21225813

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 08:44AM PDT, ID: 21246404

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 09:29AM PDT, ID: 21246873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 12:24PM PDT, ID: 21248281

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 12:53PM PDT, ID: 21248539

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 09:28PM PDT, ID: 21251260

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 06:01AM PDT, ID: 21253412

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 07:59AM PDT, ID: 21254588

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 08:22AM PDT, ID: 21254821

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 08:56AM PDT, ID: 21255210

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.01.2008 at 09:33AM PDT, ID: 21255603

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Microsoft Visual Basic.Net, .NET Framework 2.0
Tags: VB.Net 2005
Sign Up Now!
Solution Provided By: jcoehoorn
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.01.2008 at 11:35AM PDT, ID: 21256746

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628