Don't modify the designer files if you can help it. If the file changes a
lot of times the designer will overwrite any work you've put into the files
if it needs to change that piece. That's why the designer files say to not
modify them and why partial classes are so good.

)
In your control, override the Dispose(bool) method and handle your cleanup
there. You'll want to make sure you only handle the disposal when disposing
is true, false gets passed to the method when the destructor gets called by
the garbage collector. In which case if it is false, the objects you're
trying to clean up have already been released and will be null. Then, in
your form's closing event, simply call the Dispose() method on your user
control.
Also, about disposal of private objects - generally speaking, I tend to only
implement IDisposable when the private fields of a type implement
IDisposable themselves.
"Victor" <(E-Mail Removed)> wrote in message
news

385E087-9C13-4BF0-9E31-(E-Mail Removed)...
> Hi,
>
> I have a UserControl (C# WinFroms application) that requires some cleaning
> code to run when a form with control is closed. Where I can put that
> code?
>
> There is no ControlClosing or ControlClosed event.
> I can put my code into UserControl.Desgner.cs Dispose method, but that
> seems
> to be a bad practive.
>
> What do I do?
>
> Thanks.
>
>
>