Thanks Ramiro, that new to me - unfortunately it doesn't help in this case...
I'm dragging a component (not a control) to a winform and I'd like the designer to generate not only the initialize calls (which it does), but additionally the shutdown (dispose) code. This works well for controls (through the base classes Controls collection), but I don't see a similar thing for simple components. Again - thanks for the tip. My regards Axel -----Original Message----- From: Ramiro [mailto:[EMAIL PROTECTED]] Sent: Sonntag, 14. April 2002 00:17 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Components, Designer and Dispose 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. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.