Free resources of user control
-
Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert
-
Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert
Hi, When a form is disposed, all child controls are disposed. So you have hust to dispose the form. HTH.
-
Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert
-
You can use the
Disposed
event to add an event handler that will be called when the controls is being disposed.--- single minded; short sighted; long gone;
Good point. Should have thought of this myself. Although I normally try to override base functions instead of binding events in the user control/form itself this sound good in this particular case where the Dispose method is already overriden in the Designer code. Thanks. Robert