If I accidentally double-click a button on a Winform in the visual studio designer an event handler is added. Deleting the event handler causes the compiler to throw an error indicating that the class definition does not contain the event handler. How do I fix this issue?
If I accidentally double-click a button on a Winform in the visual studio designer
Share
You need to delete the reference to the event in the designer code created by visual studio. I don’t recommend going into the code itself, since you can mess stuff up.
Select the button in the designer, and open the properties toolbar. Go to the events tab in the properties toolbar. Find the “OnClicked” or “Clicked” event and remove the method associated with it. Now you can delete that event in your code and it shouldn’t complain.