ByRef Vs. ByBal

what is the default behavior of asp for passing values to a function, byRef or byVal? i was under the assumption that if you do not specify, then it defaults to passing the parameter byRef. so for example, the following function is accepting param1 and param2 as
"byRef" parameters:

function myFunction(param1,param2)
'do something
end function

am i correct?

View Replies


ADVERTISEMENT

Array Of Variables ByRef

Using ASP/VBScript, Is it possible to populate an array with variables in such a way that later changing the value of the variable will change the value stored in the array?

For instance:
dim var1, containerarray
var1 = "Initial Value"
containerarray = array(var1)
var1 = "New Value"
for each x in containerarray
response.write("The value is: "& x)
Next

Would ouput "The value is New Value"

View Replies View Related

Passing Dictionary Object Byref

Passing Dictionary object byref

Ive created an ASP class that uses a dictionary object which is filled
from a recordset. It passes the object to the propterty of another ASP
class byref:

Public Property Let dicReplaceVars(byref vdicReplaceVars)
set p_ReplaceVars = vdicReplaceVars
End Property

Private p_ReplaceVars

where it is used in this other class a few times to replace values in
an array: Code:

View Replies View Related

Returning Values - Which Is Faster? ByRef Sub Or Value-returning Function

What is a faster/better coding practice?

Method 1:

Code:
Sub myFunction(byRef x)
x = x + 1 ' do something with x
End Sub

x = 7
myFunction(x)
response.write x ' shows 8
Method 2:

Code:
Function myFunction(x)
myFunction = x + 1 ' do something with x
End Function

x = 7
response.write myFunction(x) ' shows 8

Also discuss considerations when there are more than one variables that need to be changed.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved