C# .NET Winforms Form CancelButton not working
I've recently had a problem that the "CancelButton" property on a WinForm wasn't working. When it should cause the form to close when you press the Escape (ESC) key, nothing was actually happening. I put this down to the fact that I'd been on a very long bike ride the day before and was rather tired but it's because I'd named the button "CancelButton" which is of course the same as the property on the form causing a circular reference. I thought I'd post this rather simple fix because it's so stupidly simple someone may overlook the solution on a day they're tired too.