Event Handlers (+5 VB.Net)
Creating event handlers is a pain in the butt. That is why it is so important for the IDE to do it for you. Here is how it is automatically done in VB.Net and C#.
In VB.Net, creating an event handler is as easy as selecting the member that has the event and then selecting the event.
C# also has a shortcut. You can go to the class constructor and type the event reference and then “+=<tab><tab>”.
You can see that automatic event handler code generation is much easier in VB.Net. What you can’t see from the screenshots is how much the background compiling helps in the VB.Net case. In order to generate event handler code in C#, you have to successfully compile first. VB.Net does this compiling in the background, and it does not matter if there are errors in your code.
Finding Event Handlers
So what happens when you need to find an event handler quickly?
In VB.Net, the exact sequence can be used again. All members in the file that have events are listed in the drop down, and the events that have handlers are bolded. In C#, you will need to rely on naming conventions, and either do a search for the method name or else find it in the method drop down.
It is possible that just because you find the name in the C# drop down with your predefined naming convention, that does not mean that the event handler was actually created (e.g. the add handler line was taken out of the class constructor or it was remarked to do some debugging, and never uncommented).
Removing Event Handlers
To remove an unneeded event handler, half the work is needed in VB.Net. In VB.Net, you only need to delete the automatically created method. In C#, you need to delete the automatically created method and then go to the constructor and delete the line that you typed.