By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,326 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,326 IT Pros & Developers. It's quick & easy.

AddHandler syntax

P: n/a
Hello

In my code I add an event Handler for the state change event to a
connection. Both syntaxes below work

AddHandler cnnLibrary.StateChange, New StateChangeEventHandler _
(AddressOf OnStateChange)
AddHandler cnnLibrary.StateChange, AddressOf OnStateChange

I don't find any difference between the code with or without
New StateChangeEventHandler

Can anyone explain the difference between those two.
The Sub OnStateChange is declared Private in the form class

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Can anyone explain the difference between those two.


There's no real difference, the second one is a shortcut that saves
you some typing.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 21 '05 #2

P: n/a
New is implied.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

<us**@domain.invalid> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello

In my code I add an event Handler for the state change event to a
connection. Both syntaxes below work

AddHandler cnnLibrary.StateChange, New StateChangeEventHandler _
(AddressOf OnStateChange)
AddHandler cnnLibrary.StateChange, AddressOf OnStateChange

I don't find any difference between the code with or without
New StateChangeEventHandler

Can anyone explain the difference between those two.
The Sub OnStateChange is declared Private in the form class

Thanks

Nov 21 '05 #3

P: n/a
* us**@domain.invalid scripsit:
In my code I add an event Handler for the state change event to a
connection. Both syntaxes below work

AddHandler cnnLibrary.StateChange, New StateChangeEventHandler _
(AddressOf OnStateChange)
AddHandler cnnLibrary.StateChange, AddressOf OnStateChange

I don't find any difference between the code with or without
New StateChangeEventHandler

Can anyone explain the difference between those two.


There is no difference except in the source code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.