You will encounter several existing delegates as you continue learning more about VB .NET. It is important to keep in mind that these delegate types are constrained by the procedure signatures used to define them. Determine the signature and you will know the kind of data passed when the delegate is invoked. You can easily rely on the help system to provide you this information on a case-by-case basis.
Rather than try to provide you with a comprehensive list, I will mention two very common delegates here briefly . The first is EventHandler , and the second is PaintEventHandler .
Both EventHandler and PaintEventHandler have a first argument in common, sender , defined as an Object type. The sender argument is usually the control that invoked the delegate. The second argument for EventHandler is a System.EventArgs parameter, and for PaintEventHandler it is System.Windows.Forms.PaintEventArgs .
EventArgs is really a placeholder in anticipation of event handler delegates that may need more information, like Paint events. PaintEventArgs contains an instance of the Graphics object that represents the painting surface of the control that raised the event. (Delphi programmers know the painting surface as the Canvas , and most Windows programmers know that the painting surface is referred to as a Device Context , or DC.)
By handling the Paint event you can get an instance of a control's Graphics object and perform custom painting when the control needs to be painted . The Shape classes demonstrate custom painting. Refer to Chapter 2 for examples that demonstrate the Paint event handler.