Hi Kundan,
ByVal:- means passing a copy of a variable to your Subroutine. You can make changes to the copy and the original will not be altered.
ByRef:- means that you are not handing over a copy of the original variable but pointing to the original variable.Here original value will be changed.
Ex:-
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
Result
original value= 20,30
changed value= 20,40
Thanks