|
-
Jan 9th, 2001, 07:41 PM
#1
Thread Starter
New Member
Friends
I need to know in a VBScript how to do I call a method with 2 parameters by reference.
I tried call
Object = CreateObject(ActiveX.function)
and then
Object.method (ByRef array1, ByRef array2) and it did not work.
I need to pass this by reference only because the method will update the array information based on some validation.
Would appreciate any help
Thanks
-
Jan 10th, 2001, 12:25 AM
#2
Guru
In your ActiveX object, make sure your parameters are defined as byref myArray as variant
Example:
Public Function DoIt(ByRef MyArray1 as Variant, ByRef MyArray2 as Variant) as Boolean
Tom
-
Jan 10th, 2001, 10:45 AM
#3
Thread Starter
New Member
Already have it ByRef in the method
In my called methood, I already have it as
methodA (ByRef arr1 As Variant, ByRef arr2 As Variant)
but still whatever I pass is still taking by value.
In fact, I wrote a small VB stub which calls this method and I am noticing that the array is called by Reference. It is only when I am calling in VBscript that it is calling the method by Value, on default.
Thanks
Kondal
-
Jan 10th, 2001, 11:16 PM
#4
Guru
Hey Kondal
I just sent this to you in an Email, but if you don't get it, here it is
This works fine for me: my VB function is able to modify the contents of the array and ASP is then able to read the changes
ASP code
Code:
<%@Language=VBScript EnableSessionState=False%>
<% option explicit
dim myArray1(0)
dim myArray2(0)
dim objObject
set objObject = server.CreateObject("prjTest.Class1")
call objObject.doit(myArray1, myArray2)
set objObject = nothing
Response.Write myArray1(0)
Response.Write myArray2(0)
%>
VB Code -- call your project "prjTest" and leave the default class name as "Class1"
Code:
Public Sub DoIt(ByRef myArray1 As Variant, ByRef myArray2 As Variant)
myArray1(0) = "HelloWorld!"
myArray2(0) = "Hi!"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|