Posted by: Sourav | August 20, 2016

A simple delegate example in VB,Sourav VB Teacher,Kolkata

Option Strict On
Option Explicit On
Imports System

Module Module1
Delegate Sub printmethod(ByVal message As String)
Sub Main()
Dim del1 As printmethod = New printmethod(AddressOf printmethodsub)
del1(“Hello from delegate”)
End Sub
Sub printmethodsub(ByVal message As String)
Console.WriteLine(“Hello I am a sub,called by a delegate and this is the message {0}”, message)

End Sub
End Module




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: