26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

in command click of the button object of the Delegate is created and the method pointer<br />

is received from “AddressOf ” keyword.Then by using the “Invoke” method the method<br />

is invoked.<br />

(B) What are event’s ?<br />

Figure :- 6.4 Delegate in Action<br />

As compares to delegates events works with source and listener methodology . So listener’s<br />

who are interested in receiving some events they subscribe to the source.Once this<br />

subscription is done the source raises events to all of it’s listener when needed.One source<br />

can have multiple listeners.<br />

In example sample given below class “ClsWithEvents” is a event source class , which has<br />

a event “EventAddString()”.Now the listener’s who are interested in receiving this event’s<br />

they can subscribe to this event.In class “FrmWithEvents” you can see the handles clause<br />

which is associated with the “mobjClsWithEvents” objects.<br />

Public Class ClsWithEvents<br />

Event EventAddString(ByVal Value As String)<br />

Public Sub AddString()<br />

RaiseEvent EventAddString(“String added by Event”)<br />

End Sub<br />

End Class<br />

106<br />

*How well do you work with people? Do you prefer working alone or in teams?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!