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

StackOverflow https://stackoverflow.com/questions/2810748

Question

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.

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top