views:

22

answers:

1

Hi all,

I am trying to close all opened listeners using something like :

GP.GlobalInfo.CommWCF.serviceClient.GetFilteredMessageCompleted -= new EventHandler<GetFilteredMessageCompletedEventArgs>(serviceClient_GetFilteredMessageCompleted);

Since the form is being closed, every listener should be closed as well. (am I right?)

Since user control does not have Closed event handler, I was not sure where to put the code above.

What would be the event handler when an user control is being closed?

Thanks,

A: 

Technically garbage collection should take care of your controls as far as memory disposal but you can listen for the application.exit event as well if you want to write custom logic.

Jeff Gwaltney