Monday, January 10, 2011

How to add new event handlers

 
 
 
Hi Michae

I'm guessing you mean how to add new event handlers for the different components on your form (just clarifying).

I see two options
1. In the design view, highlight the control in question. In the properties window hit the event button (the lightning bolt). That will show you all of the events that the control can handle - find the one you want and type the name you want and you'll get thrown into the code editor with a function ready to be filled in
2. If adding the event handler manually via the C# code, try typing the name of the control, followed by a "." to trigger the intellisense. Pick the event your want (again the events have the lightning bolt) by hitting TAB, type in the "+=" needed to add the event handler delegate, then follow the instructions that popup (basically hit TAB twice again and VS.NET will add an event handler in for you automagically)