The C# team posts answers to common questions and describes new language features
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