AddHandler Statement


AddHandler Statement

Syntax

     AddHandler nameOfEventSender, AddressOf   nameOfEventHandler 


nameOfEventSender (required)

The name of a class or object instance and its event, such as Button1.Click


nameOfEventHandler (required)

The name of a subroutine that is to serve as the event handler for nameOfEventSender

Description

The AddHandler statement binds an event handler to an event.

Usage at a Glance

The AddHandler and RemoveHandler statements can be used to dynamically add and remove event-notification handlers at runtime. By contrast, the Handles keyword establishes an event-notification handler at compile time.

Example

Chapter 8 includes examples of using event handlers.

Version Differences

Visual Basic 2005 includes a new Custom Events statement that impacts the use of the AddHandler statement. See the Custom Event Statement entry in this chapter for additional information.

See Also

Custom Event Statement, RemoveHandler Statement




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net