Problem and Solutions



How do we use Async Method of Web Service


I am consuming web services in my C# winforms application. when i click on button where i am calling webmethod for eg. HelloWord();

My form is freezes till process complete. i can't do anything while Web Method is in process.

I know i should call HelloWordAsync() but I don't know how?

could anyone help me to solve this problem.

Thanks & regards
Posted by: Sam
On 23 May 2012 | Views: 2691 | Categories: Win Forms, Web Services, C#
 On 23 May 2012 05:58:22 AM
Hi Sam

That is right you should use Async Method of webservices

here is the code example, i hope it will be useful :)

//Create a object of webservices class

Services1 obj = new Services1();

//Create a Event it fire on process completion

obj.HelloWordCompleted += new HelloWordCompletedEventHandler(this.HelloWord_Finish);

//Call your Async Method
obj. HelloWordAsync();

//Create a Method which will fire on requested completion
private void HelloWord_Finish(object sender, HelloWordCompletedEventArgs args)

//args.Result have data which you webmethod has retun,
//it will be based on return type of your webmethod like dataset, datatable, string etc.

Post your Solutions  


Other lins

.Net Techies
Other lins