AddHandler / Remove Handler?

T

Tim

If you instantiate a web control programmatically in Form_Load and then add
a click event handler to it using AddHandler MyControl.Click AddressOf
MyEventHandler, is it necessary to call RemoveHandler MyControl.Click
AddressOf MyEventHandler in the Page_Unload event? Does not removing
handlers have any side effects?
Thanks
Tim
 
B

Brock Allen

In ASP.NET, no, it's not necessary. You typically only do this if your ccode
that was receiving the event is still running and you no longer want to receive
the event. Since ASP.NET creates a page for every request, the page and all
the child contorls are thrown away so no need to stop receiving the event
as the source of the event is gone itself, so to speak.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top