Double-clicking on a control in Visual Studio is a very intuitive way to generate the default event handler. However, I often accidentally double click on a control therefore creating an event handler that I do not need.
Usually, I do one of the following to remove the blank, unused, event handler.
Current methods
Does anyone have an easier way to undo an accidental control event generation?
You can just delete the handler in the event properties as in point 2. This should completely remove the event.
How to undo an accidental control event generation?
Save often, check in often. When making many tiny changes to something, like a form or database diagram, it helps to have either fast or local version control, so you can perform pretty fine-grained rollbacks in the case you mess something up.
Visual Studio's Undo will only take you back so many steps if the designer allows it, while a commit / shelve after each action (adding a control or database table, changing certain properties) creates a fixed point in time to which you can return.
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