I've created a custom WinForms UserControl and would like to override Dispose. However the code generated by the designed already contains a Dispose method. How can I add custom cleanup code to my component?
You can move the Dispose method from the code generated file into your control cs file. I've used this under .net 2.0, it should work on 4.0 as well.
It's badly documented but you can Cut & Paste the Dispose method over to your side of the partial class.
And then extend it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With