Saturday, December 01, 2007

Stop Visual Studio.Net Editor Generating Unnecessary WinForm Controls Code[.NET]

Microsoft Visual Studio.NET editor automatically generates code for each and every control which you drag and drop on a WinForm. But we mostly don’t refer to the code of certain controls like labels, panels, group boxes.

It is possible to get rid of auto-generated code for such controls by setting the property GenerateMemberCode value to false.

For example if you have a label control in a WinForm which you don’t refer in the code and you prefer to remove the cluttered code of that label then follow these steps

  1. Select the label control displayed in the WinForm designer
  2. Open properties window
  3. Set GenerateMember property value to false