Imports System
Public Class MainClass
Public Delegate Sub StringSubDelegate(ByVal aString As String)
Shared Sub Main()
Dim test As New ClassForStringSubDelegate()
Dim aDelegate As StringSubDelegate
aDelegate = AddressOf test.TestSub
aDelegate("Hello")
aDelegate = AddressOf test.TestMsgBox
aDelegate("Hello")
End Sub
End Class
Public Class ClassForStringSubDelegate
Public Sub TestSub(ByVal aString As String)
Console.WriteLine(aString & aString)
End Sub
Public Sub TestMsgBox(ByVal aString As String)
Console.WriteLine("I am in a Message Box" & aString)
End Sub
End Class