<mr***@exhibitworks.com> schrieb
Is there any additional overhead for declaring a variable using
the WithEvents keyword even if none of the events are being
handled?
As it's already been mentioned, Withevents does Addhandler/removehandler
internally for you.
Variables declared with Withevents are actually properties.
Writing
private withevents cmd as button
sub cmd_click(...) handles cmd.Click
end sub
is exactly the same as
private _cmd as button
private property cmd() as button
get
return _cmd
end get
set (byval value as button)
if not _cmd is nothing then
removehandler _cmd.click, addressof cmd_click
end if
_cmd = value
if not _cmd is nothing then
addhandler _cmd.click, addressof cmd_click
end if
end set
end property
The more "Handles" procedures, the more removehandler/addhandler statements
are created.
--
Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html