views:

10

answers:

1

When in a code editor 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.

+1  A: 

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.

Hans Passant
No, I won't touch the dll. In Netbeans I remember I could easily configure this behaviour editing the templates (simple text files).
vulkanino