visualstudio 2010 VB.NET customizing the code automatically displayed when I write New
When in a code edit开发者_StackOverflow社区or I write
Sub New (enter)
The editor automatically inserts:
Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
How can I customize the code it writes? Can't find it in the code snippets manager.
This string is baked into Common7\IDE\1033\msvb7ui.dll. In other words, it is hard-coded in the binary code that implements the VB.NET IDE.
This is also the case for the auto-generated code when you implement IDisposable. Much worse actually since that code is inappropriate 99.9% of the time.
If it really annoys you, you could use File + Open + File and navigate to the DLL. Open the string table and double-click "String Table". It is string #1059. Note that you cannot change the line spacing or the comment. Do make sure you make a backup of the file, I didn't try it myself.
精彩评论