PC Review


Reply
Thread Tools Rate Thread

Delegates and Events Handler, what is the defference???

 
 
al
Guest
Posts: n/a
 
      12th Dec 2003
Greetings,

Can someone please tell me the what is the defference betweeen
delegates and events handler???


MTIA,
Grawsha
 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      12th Dec 2003
"al" <(E-Mail Removed)> schrieb
> Greetings,
>
> Can someone please tell me the what is the defference betweeen
> delegates and events handler???


An event handler is a procedure that handles events. A delegate is an object
pointing to a procedure, and the procedure can be an event handler but it
does not have to be.


--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
 
Blumidoo
Guest
Posts: n/a
 
      12th Dec 2003
> Can someone please tell me the what is the defference betweeen
> delegates and events handler???


..NET application raise events. They can (and should) be handled by a special
set of subs, ie.

Private Sub cbMyCombo_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cbServerType.SelectedIndexChanged

this sub handles SelectedIndexChanged event for ComboBox control

Delegates, on the other hand, are like C++ pointers to functions, but more
powerful. From VS.NET help:

"It is a reference type that refers to a Shared method of a type or to an
instance method of an object. The closest equivalent of a delegate in other
languages is a function pointer, but whereas a function pointer can only
reference Shared functions, a delegate can reference both Shared and
instance methods. In the latter case, the delegate stores not only a
reference to the method's entry point, but also a reference to the object
instance with which to invoke the method."

Events and delegates are closely associated in Visual Basic .NET. An event
is a message sent by an object announcing that something important has
happened. Events are implemented using delegates, a form of object-oriented
function pointer that allows a function to be invoked indirectly by way of a
reference to the function.

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Events versus Multicast Delegates for events(VB.NET) =?Utf-8?B?aGVyYmVydA==?= Microsoft Dot NET 2 14th Feb 2007 02:51 PM
Advanced use of delegates to automatically disconnect delegates from a set of events kristian.freed@gmail.com Microsoft C# .NET 2 18th Nov 2006 09:56 PM
Events and delegates Chak Microsoft Dot NET Framework 3 22nd Oct 2005 08:21 AM
Events and Delegates Veronica Jacobs Microsoft ASP .NET 1 2nd Jun 2004 10:17 AM
New to c# - events & delegates Trevor Microsoft C# .NET 3 9th Jan 2004 01:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 AM.