Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.84 KB

addressof-operator.md

File metadata and controls

51 lines (35 loc) · 1.84 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: AddressOf Operator (Visual Basic)
AddressOf Operator
07/20/2015
AddressOf
vb.AddressOf
AddressOf operator [Visual Basic]
addresses, passing to API procedures
8105a59d-60d8-4ab5-b221-5899cdfacbf4

AddressOf Operator (Visual Basic)

Creates a delegate instance that references the specific procedure.

Syntax

AddressOf procedurename  

Parts

procedurename
Required. Specifies the procedure to be referenced by the newly created delegate.

Remarks

The AddressOf operator creates a delegate that points to the sub or function specified by procedurename. When the specified procedure is an instance method then the delegate refers to both the instance and the method. Then, when the delegate is invoked the specified method of the specified instance is called.

The AddressOf operator can be used as the operand of a delegate constructor or it can be used in a context in which the type of the delegate can be determined by the compiler.

Example 1

This example uses the AddressOf operator to designate a delegate to handle the Click event of a button.

[!code-vbVbVbalrDelegates#8]

Example 2

The following example uses the AddressOf operator to designate the startup function for a thread.

[!code-vbVbVbalrDelegates#9]

See also