The ByVal keyword indicates that an argument is passed in such a way that the called procedure or property cannot change the value of a variable underlying the argument in the calling code.
The ByRef keyword indicates that an argument is passed in such a way that the called procedure can change the value of a variable underlying the argument in the calling code.
Example
Public Class Form1
Inherits System.Windows.Forms.Form
Dim x, y As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
x = 20
y = 30
MsgBox("original value=" & x & " " & y)
change1(x)
change2(y)
MsgBox("changed value=" & x & " " & y)
End Sub
Sub change1(ByVal x As Integer)
x = x + 10
End Sub
Sub change2(ByRef y As Integer)
y = y + 10
End Sub
End Class
Output
original value = 20,30
changed value = 20,40

