Example:
Sub Add1 (byval no as int32) no = no 100nd SUB
Sub Add2 (byref no as int32) no = no 100nd SUB
Private sub button1_click (sender as object, e as eventargs) Handles button1.click Dim A as INT32 A = 100 Add1 (a) msgbox ("A value:" & a) display: a value of 100
Add2 (a) msgbox ("The value of A:" & a) 'Display: A value is 200, because the parameter NO in the add2 is Byref, that is,' is transmitted by address, so the NO is modified in the ADD2, The value of the 'source parameter A will also be modified. End Sub
BYVAL is that the transfer value source data will not be modified. You can use this value as its own local variable.
Byref is a delivery address, and source data may be modified to have an operation of this variable will affect the variable you passed into, just like a pointer feel.