Here's the steps to reproduce the problem :
- Create a c# project with a form with 1 control, let's say a textbox.
- Using the properties window (lightning bolt thingy), add a开发者_开发知识库 "click" event.
- Write some code in that method.
- Using the properties window, remove the content of the "click" event cell.
I would like to know why is the code from step 3 has disapear (but not the method signature).
Normal behavior from the IDE ? Option in the "tools-options" menu ?
The method you created should remain even after it has been unhooked from the control's event. The only time VisualStudio will automatically remove the method is if the method is empty. Once you add custom code, the method should not be removed.
精彩评论