Happens that I’m generating by mistake some handler code (eg by double/clicking some control)
eg:
private void btLinks_Click (object sender, EventArgs e) {
// ....
}
Other time Im just deleting method body and want to remove it’s reference in designer
Is there any way in VS to quickly remove this hander?
Currently im doing this that way:
- shift + F12 -> dind reference
- go to *.designer file
- remove line (Ctrl+L)
- return to class code and remove method
I’d love to find easier and faster way to archive the same.
I wonder how you are doing this guys?
(Cant be just only me dealing with this… 🙂 )
3
Answers
If you just made the handler as your last action (accidental double click) then you can
Ctrl+Z
and confirm ‘Yes’ to the Loss of Work warning. It will remove both the handler and the designer code.If you delete the event in the designer (right click the event in the properties > reset, or delete text), the handler will be removed iff there is no code in that handler.
you can remove event handler by selecting button (or any other control), properties windows, clic event icon, and erasing text beside event :
Go to the control properties, events and find the corresponding event. Delete it in the properties window.
Image is to reference the window. But instead of adding, you will be removing the value in the event box