473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

al
Greetings,

Can someone please tell me the what is the defference betweeen
delegates and events handler???
MTIA,
Grawsha
Nov 20 '05 #1
2 1248
"al" <gr*********@yahoo.com> 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

Nov 20 '05 #2
> 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
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John A. Bailo | last post by:
I'm working through some code that uses events and delegates. Pardon me, but I understand delegates to be a little like function callbacks in c. I coded up a code sample and started playing...
15
by: Rhy Mednick | last post by:
I have a class (let's call it ClassA) that I've written which has events. In another class (let's call it ClassB) I create a collection of ClassA objects. In a third class (ClassC) I create a...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
15
by: Marshal | last post by:
First... let's deal with Delegates. Comments welcome. 1) Invoking a NULL delegate is annoying. ** (It should just do nothing rather than crash.) 2) It's too easy to accidently attach multiple...
4
by: DKode | last post by:
Hello, I have a question about delegates and events I have a basic understanding of each, but in the apps I'm building I'm never needing to use these tools. I'm wondering when and where you...
8
by: Nicky Smith | last post by:
Hello, I'm reading Mike Gunderloy's Mcad Vb.net book, and I've also read the MS press Mcad book for the same topic ".. Windows based applications with VB.net" for exam 70-306. In the...
4
by: Tim | last post by:
There are a set of clients who need to be notified of certain events. I have used events and delegates (publisher-Subscriber model) for the notification mechanism. All the clients register with...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
7
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.