Name

CallByName Function — Microsoft.VisualBasic.Interaction

Synopsis

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 type CallType indicating what type of procedure is being called. The CallType constants are:

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.

Named Arguments

Yes, if Args( ) is omitted

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.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.