O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

CallByName Function

Class

Microsoft.VisualBasic.Interaction

Named Arguments

Yes, if Args ( ) is omitted

Syntax

CallByName(Object, ProcName, UseCallType, Args(  ))
Object (required; Object)

A reference to the object containing the procedure being called.

ProcName (required; String)

The name of the procedure to call.

UseCallType (required; CallType constant)

A constant of the type CallType indicating what type of procedure is being called. CallType constants are listed in the following table.

Constant

Value

Description

Method

1

The called procedure is a method.

Get

2

The called procedure retrieves a property value.

Let

4

The called procedure sets the value of a property.

Args (optional; any)

A ParamArray argument representing the arguments required by the procedure being called.

Return Value

Depends on the return value (if any) of the called procedure

Description

Provides a method for calling a class member by name.

Since ProcName is a string expression, rather than the literal name of a routine, it is possible to call routines dynamically at runtime using a string variable to hold the various procedure names.

Rules at a Glance

  • The return type of CallByName is the return type of the called procedure.

  • ProcName is not case sensitive.

  • UseCallType can either be a numeric value or a constant of the CallType enumeration. In the latter case, the enumeration name must be specified along with the constant name, as in CallType.Method.

  • Args ( ) must be a parameter array. A parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required