VB.Net Carrying out different threads in order

Hi Experts.  In my VB.Net app, I have a Wizard which collects email server details and an email address from the user.   I have a number of functions which firstly pings the server, then checks connectivity to the server, then validates the email address and then finally sends a test email.   I want each of the functions to run on a separate thread but to run in sequence and only when the function before it returns True.   Please can someone advise me on the best way the achieve this, especially getting the result back from a function in a new thread?  Many thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
>>I want each of the functions to run on a separate thread but to run in sequence

There is only one way to do that in sequence:  You must wait for one thread to finish before starting the next.
(Which rather defeats the point of having multiple threads - much simpler to just have one function run after the next in your code)
PNRTAuthor Commented:
Thank you for the reply, that makes a lot of sense.   So my code would call each function in turn in the normal way and would be dependant on the returned result, but I'm not sure how I would call the function in a separate thread and also get the result back.  Would you have an example?
AndyAinscowFreelance programmer / ConsultantCommented:

There is a backgroundworker (thread) class in .net
In the DoWork function you would call each of your functions in order

pseudo code:
PNRTAuthor Commented:
Thanks, I understand the backgroundworker and running the functions in that thread but I would need to get the results of each of the functions back to the original thread.   I thought of having a variable for each function and a timer on the original thread checking each variable for True or False.  Is there an easier way?   Thanks again for the help
AndyAinscowFreelance programmer / ConsultantCommented:
You can pass a variable into the backgroundworker - so you can set some sort of status information (eg an enum) in that variable when you exit the thread.  That allows the main thread to check what has happened.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.