By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,673 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

How to use thread for function with parameters.

P: n/a
Hi,

I have thread declared in this way. Dim t As New Thread(AddressOf
ThreadProc). Here ThreadProc is a function with two parameters. But i am not
able to use function name with addressof, It accepts only if it is 'Sub' and
not 'function'.
Can anyone help me with some good example, to use thread for functions with
some parameters.

thanking u,

regards,
Sivaraman.S
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Sivaraman,

The common practice , I beleive, is to encapsulate your method in some class
, or have the arguments as member variables of the class which the function
is part of.
Then before calling the start method set the variables.
The threaded function will then use these variables.
These variables must be shared/static as the thread function also needs to
be the same.

See the following Google Group Thread for some code example nearly
equivalent to above description.
http://tinyurl.com/3v4u8

HTH
rawCoder

"Sivaraman.S" <Si********@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
Hi,

I have thread declared in this way. Dim t As New Thread(AddressOf
ThreadProc). Here ThreadProc is a function with two parameters. But i am not able to use function name with addressof, It accepts only if it is 'Sub' and not 'function'.
Can anyone help me with some good example, to use thread for functions with some parameters.

thanking u,

regards,
Sivaraman.S

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.