Why do you want to both set the value of argument and then return the value from the function. Any one is sufficient
Either use
Sub
as below
Sub Main
Dim x as Integer, y as Integer, z as Integer
x=5
y=10
A(x,y,z)
Console.WriteLine(z)
End Sub
Public Sub A(ByVal x as Integer, ByVal y as Integer, ByRef z as Integer)
z = x + y
End Sub
or use the
Function
as given in Solution 1