Delegates in Visual Basic.NET

Category:
C#, VB.NET, ASP.NET
Type:
Applications
Difficulty:
Intermediate
Author:
Pramod Kumar Singh

Version Compatibility: Visual Basic.NET

More information:
Delegates are objects that can call the methods of other objects for you. For this reason, delegates are sometimes described as type-safe function pointers. Visual Basic.NET has moved to an event model that is based on delegates. Although you can create your own delegates, in most cases Visual Basic.Net will create the delegate and take care of the details for you. But in certain case you have to create them. Here is a sample that demonstrate the creation and use of Delgates with Visual Basic.NET.

To get it to run in Visual Studio.NET, create a new console application and paste the code below into Module1.vb.

Originally developed for .NET Beta 1; update on 03/25/02 to work in Visual Studio.NET Version 1.0.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: