...

View Full Version : Passing a parameter by reference



codefox
08-09-2004, 07:42 PM
It's been a while since I worked with ASP, I've forgotten some concepts. I know vb (and hence vbscript) passes arguments by reference. The following page gave me 100, I expected 1000:


<%
Dim a

a = 10

call test1(a)

Response.Write a

Sub test1(b)
b = 100
test2(b)
End Sub

Sub test2(c)
c = 1000
End Sub
%>


Why's that test2(b) did not change the value of b in test1? Is it because parameter variables are not passed by reference?

Thanks.

Grant Palin
08-09-2004, 07:56 PM
I think VB and VBScript actually pass by value...I may be wrong though.

However, just to be sure, try adding "ByRef" in front of the appropriate paraemter in your parameter lists.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum