Reputation: 13769
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?
Upvotes: 3
Views: 233
Reputation: 151654
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.
Upvotes: 1
Reputation: 341
You can just delete the handler in the event properties as in point 2. This should completely remove the event.
Upvotes: 2