A function can only return a single value but if you were to concatenate the two values that you want to return eg-
value1 & ", " & value2
so if you pass in (x, y) and you get back "24, 25" - note the result will be a string.
You could pass the variables you want the function to write to by reference. (Change the function to a sub).
for example
Sub Add(a as single, b as single, ByRef c as single, ByRef d as single)
c=a+b
d=b+c
End Sub
The following code would change the values of c and d to a+b and b+c respectively.
This kind of acts like a pointer in C. Instead of sending a value to the function
it sends a address so that the program can modify the value directly...
You could pass the variables you want the function to write to by reference. (Change the function to a sub).
for example
Sub Add(a as single, b as single, ByRef c as single, ByRef d as single) ...
Just wanted to point out, arguments are passed by reference by default in VB. You only need to specify if you want to pass them by value. In other words, while you might sometimes code the ByVal keyword, there is really no need for ByRef.
As an example, these two definitions produce the same result...
[CODE=vb]Sub Add(a As Single, b As Single, c As Single, d As Single)
Sub Add(a As Single, b As Single, ByRef c As Single, ByRef d As Single)[/CODE]
Comment