Simplified Event Handling a la VS .NET 2003

Simplified Event Handling a la VS .NET 2003

  • Comments 3

Working with events under the .NET platform requires you to be aware of a number of details. For example, if you know the name of the event you wish to handle, you must then know the name of the related delegate type. Once you know that much, you must then be aware of the correct signature of the delegate target method.

To simplify matters, VS .NET 2003 will now automatically display the correct delegate name as well as write a prototype for the delegate target. To try this out yourself, create a Windows Forms application and place a single Button type onto the designer. Next, type the following code within InitializeComponent():

this.Button1.Click +=	 // Message pops up to tell 
                       // you to hit the Tab key…

Once you hit the Tab key, you will find the correct delegate is already in place. Hit the Tab key again and you will receive a delegate target method of the correct signature. Be aware that this shortcut works for any event, custom or standard (GUI-based or not).


Tip from Andrew Troelsen
Posted by: Duncan Mackenzie, MSDN
This post applies to Visual C# .NET 2003

Leave a Comment
  • Please add 6 and 6 and type the answer here:
  • Post
Page 1 of 1 (3 items)