Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi Everyone,

I am Developing Application for the mobile device. In which have i am using Service.
When i am Invoiking Service method it response more then One Time.



In Form Load..(Define the Eventhandler )

serviceobj1.Get_InformationCompleted +=new EventHandler<ServiceObject1.Get_InformationCompletedEventArgs>(serviceobj1_Get_InformationCompleted);


And In Button Click

serviceObject1.Get_InformationRequest req  = new serviceObject1.Get_InformationRequest ();
req.Body  = new ServiceObject1.Get_InformationRequestBody();
req.Body.id  =Common.CurrentUserID;
Common.serviceobj1.Get_InformationAsync(req);



C#
void serviceobj1_Get_InformationCompleted(object obj, ServiceObject1.Get_InformationCompletedEventArgs e)
        {
            MessageBox.Show("Complete");
        }



When i am clicking on the button then i have get response (message Complete) more then one.


So Can u please help me how can i fix it.
Posted
Comments
db7uk 19-Jun-12 9:06am    
not sure I follow. What application client are you developing. Your tags include wpf and asp.net???? Also is the code in any usercontrols etc? Could you provide more detail using "Improve question".

1 solution

Hi Everybody,

I have found the solution for this problem. Actually i have a form and Eventhandler is added in Page Load. But In case of back and Forward i am not disposing the form instance. and Again i am coming back to this form so that the one more event is added for this handler.


So the conclusion is that in case of back and dispose we should need to dispose the class instance or remove handler.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900