H
Henry Jia
Hello all, help is needed.
We're make some user controls and met the memory leak problem and the reason
already found. It's the fault of attached event handles not been removed.
Here's the background:
The VB.Net was used and the event handler of control was added by default
action (such as double click on the button control). We made lots of user
control to control the different items. And the controls are dynamic created
and added then removed. But after the control was removed even dispose
method was called, the GDI objects and User objects are still bigger than
the values before added. We found that if remove the event handles in the
control can help solve this problem. But it has some work to add code in
every page to remove handlers, so we want to know if there has other method
can help without modify on each control.
In short, is there has any replacement of following code in user
control(assume our control has a button named Button1 which with an attached
event handler Button1_Click)
RemoveHandler Button1.Click, AddressOf Button1_Click
Input:
ctr - our user control
Thanks in advance!
We're make some user controls and met the memory leak problem and the reason
already found. It's the fault of attached event handles not been removed.
Here's the background:
The VB.Net was used and the event handler of control was added by default
action (such as double click on the button control). We made lots of user
control to control the different items. And the controls are dynamic created
and added then removed. But after the control was removed even dispose
method was called, the GDI objects and User objects are still bigger than
the values before added. We found that if remove the event handles in the
control can help solve this problem. But it has some work to add code in
every page to remove handlers, so we want to know if there has other method
can help without modify on each control.
In short, is there has any replacement of following code in user
control(assume our control has a button named Button1 which with an attached
event handler Button1_Click)
RemoveHandler Button1.Click, AddressOf Button1_Click
Input:
ctr - our user control
Thanks in advance!