I was just asked this question and I didn't know the answer:
When you're working on a Winform project in C# (and probably VB) you have the ability to modify the form through the GUI editor and modify the code behind the form through the IDE. However, there is also generated code hidden inside the form which some people like to be able to modify. The only way I know of to edit this generated code is to open the form file in Notepad, make your changes, and save it. Is there a way to modify this code inside of the IDE?
Here is the reason I ask: Say you are creating a form. You want to set some of the property values based on constants rather than having to modify the properties via the IDE. Let's say you want to set the Visible property to FALSE. I don't really want to accept the default values then reset them in the form load or constructor. That just leads to a larger code base for no reason. It would be cleaner to have the code just use the constant value.
Thoughts?
My fear was that if you modify the generated code with Notepad or any other tool, that this code would be regenerated by Visual Studio and any changes would be lost. My initial recommendation was to modify the code in the form's constructor but my questioner wasn't convinced this wasn't just resetting the value after it defaulted to something else.
-- Matt Ranlett