[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb.net threding

Posted on 2006-04-20
6
Medium Priority
?
255 Views
Last Modified: 2010-04-17
Is it possible to pass variables in to a thread? What im trying to do is pass a client id into a routine that will process that clients data? Any one got any ideas or links , Thanks in advance
0
Comment
Question by:agent_xp
6 Comments
 
LVL 15

Expert Comment

by:Ralf Klatt
ID: 16503400
Hi,

You may pass anything you want into a thread ... I'd suggest the following samples as a starting point: http://www.codeproject.com/vb/net/threadingvbnet.asp


Best regards,
Raisor
0
 

Author Comment

by:agent_xp
ID: 16503726
ok , thats fine , but i get errors


What I want to do is select the customer and then start the thread to process the customers data,
eg
for each of the customers in the data base, one customer at a time select the data process method and pass in the customer id as the parameter into the thread eg


For Each c As ds.customer In ds.customers

Select case (data process method)

 Case “process 1”
   Start process thread 1(customerid)
 Case “process 2”
   Start process thread 1(customerid)

...... 14 different data process methods

End select

next


I hope this helps , any ideas
0
 
LVL 15

Expert Comment

by:Ralf Klatt
ID: 16503791
Hi,

I'd suggest building "classes" -> better to say "class collections" ... meaning, to build class collections according to the running processes ... each process (tied to a customer) would have an own interface (two processes, fourteen processes ... or whatever number) ... it's just an idea ;-) ...


Best regards,
Raisor
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:AlexFM
ID: 16504785
Thread function belongs to class and can work with any class variable. Set class member to desired value and start the thread.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 375 total points
ID: 16508134
As AlexFM said...

If you need a different value for each thread, then enapsulate your thread in a Class and pass the value into that class so the Thread can access it.  Then you instantiate your Class for each value and start your threads...
0
 

Author Comment

by:agent_xp
ID: 16592394
thanks Idle_Mind sorry its late
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Simple Linear Regression
Six Sigma Control Plans

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question