Threading and functions

  • Thread starter Thread starter gv
  • Start date Start date
G

gv

Hi all,

UsingVisual Studio 2005

How can I run a function in a thread where I pass in parameters to the
function
under a button click event?

I see how to run a thread for a sub but what about a function and it's
parameters
in a thread?


thanks
Gerry
 
| How can I run a function in a thread where I pass in parameters to the
| function under a button click event?

in the help file, search for:

"delegate thread"

and scroll to the example of "SimpleThread". you will see an object declared
as "delegate" ("Start(byval o as object)"). you can use a delegate to do
what you're wanting. define it with whatever parameters you wish.

that takes care of creating a new thread where you want to start it by
feeding parameters. for cross-thread communication with two or more active
threads, continue to read the help files on multi-threading and look at the
examples supplied. this is called thread synchronization in most cases.

hth,

me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top