How to call multiple methods at the same time

Posted by Varaprasadm.84 under C# on 5/3/2012 | Points: 10 | Views : 15856 | Status : [Member] | Replies : 13
Hi,

I am having 5 methods and the 5 methods contains the different data retrieval, now i want to call the 5 methods once instead of one after the another.

How can i achieve this?

Thanks in advance,
Prasad

Vara Prasad.M


Responses

Posted by: Sakthi.Singaravel on: 5/3/2012 [Member] Silver | Points: 25

Up
0
Down
Refer this its may use for u..

http://stackoverflow.com/questions/4115009/c-sharp-call-multiple-webservices-at-same-time

Regards,
Singaravel M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varaprasadm.84 on: 5/3/2012 [Member] Starter | Points: 25

Up
0
Down
How can i get using the methods? not the web services

Vara Prasad.M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/3/2012 [Member] Silver | Points: 25

Up
0
Down
can tell that methods names with parameter...?

Regards,
Singaravel M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varaprasadm.84 on: 5/3/2012 [Member] Starter | Points: 25

Up
0
Down
One is pinging the system information
another is binding the server services
another is binding the data from the database

Vara Prasad.M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/3/2012 [Member] Silver | Points: 25

Up
0
Down
use Out method...

Regards,
Singaravel M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/3/2012 [Member] Silver | Points: 25

Up
0
Down
For example..

http://www.dotnetperls.com/multiple-return-values

Regards,
Singaravel M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jmckamal on: 5/3/2012 [Member] Starter | Points: 25

Up
0
Down
Yes Its possible.

Step 1: Create a "sub procedure" by naming some X.

Step 2: Inside the sub procedure write whatever you want to do.

Step 3: Now in your main function write the below code using thread.
Dim <threadname> as New System.Threading.Thread(Addressof <Subprocedure name>)

Step 4: finally call that thread using start method by using syntax - <threadname>.start()

Step5: if you press f10 while running , when your code comes to line <threadname>.start() , all the methods which you wrote under sub function will run simultaneously, without any other invoke function.





Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varaprasadm.84 on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
Can i get the sample code using C#. And also i am using this scenario in the WEB Applications. Will it be possible???

Vara Prasad.M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kavi.Sirius on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
hi

u can call the one method inside the another method

example:

method1();//call the method1() when u r need

inside the method1()

method1()
{
method2()//call the another method
}
....

like this u call the all 5 method in call at the same time

Regards
Kavi.n

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varaprasadm.84 on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
By the above example after executing the first method only the second method will execute and after completion of second method the third method will execute.

My problem is to invoke all the three method asynchronously

Vara Prasad.M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: donraza007-15388 on: 5/31/2012 [Member] Starter | Points: 25

Up
0
Down
Then you should go for threading

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: donraza007-15388 on: 5/31/2012 [Member] Starter | Points: 25

Up
0
Down
Thread t1 = new Thread(Method1);
Thread t2 = new Thread(Method2);
Thread t3 = new Thread(Method3);

t1.Start();
t2.Start();
t3.Start();

Method1()
{
}
Method2()
{
}
Method3()
{
}

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varaprasadm.84 on: 6/13/2012 [Member] Starter | Points: 25

Up
0
Down
Can you please explain how this threads will work?
The methods in the thread are not executing

Vara Prasad.M

Varaprasadm.84, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response