Search code examples
vb.netvisual-studio-2010shortcut

In Visual Studio 2010, can you auto-generate an eventhandler in the same way as C#, using Visual Basic?


For example, you can type this.Loaded += in C# and press TAB a couple of times to automatically generate an event handler. Is there an equivelent in Visual Basic?

Typing Addhandler Me.Loaded and pressing TAB or RETURN does nothing.


Solution

  • The VB.NET IDE has a different approach, inspired by the WithEvents keyword. Note the two combo boxes at the top of the editor window. You select the (class Events) in the upper left, the event you want to subscribe in the upper right combo. That auto-generates the event handler, it has the Handles keyword.

    No help for explicit AddHandler statements that I know of.