Axel, I'm not really sure about is what you need, but you can enforce the Dispose() call with the using keyword (C#)
void SomeMethod() { ... using (SomeDisposableObject so = new SomeDisposableObject()) { .... } ... } which is identical to void SomeMethod() { ... SomeDisposableObject so = new SomeDisposableObject() try { ... } finally { so.Dispose(); } } HTH, Ramiro Calderon [EMAIL PROTECTED] ----- Original Message ----- From: "Axel Heitland" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, April 13, 2002 12:43 PM Subject: [DOTNET] Components, Designer and Dispose Hi all, I've implemented a simple component-derived class which is hosted on a windows form. For successfull shutdown the component needs a call to it's Dispose method at the end of it's lifetime; unfortunately the WinForms designer doesn't generate that code automatically so my users need write that code manually (and they forget all the time and are shouting at me ;-)) Is there any way to tell the winforms designer to generate the dispose code for me automatically ?! TIA Axel You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.