<< Prev        Next >>

ID : 328

ByRef

Function

To set argument(s) to hand to the procedures for pass by reference.

Description

This is a modifier to designate the procedure argument to pass by reference.

More than one argument can be designated by separating each by a comma.

"ByRef" is optional.

Related Terms

ByVal

Attention

Main procedure argument cannot be passed by reference.

Example

'!TITLE "Pass by Reference of Augment"
' Add 20 to a value received by passing by reference and display it on the message output window
Sub Sample_ByRef

  Dim aaa As Integer

  aaa = 10

  SubProc aaa

  ' Display "30" on the message output window
  PrintDbg aaa

End Sub

Sub SubProc( ByRef bbb As Integer)

  bbb = bbb + 20

End Sub

ID : 328

<< Prev        Next >>