PDA

Click to See Complete Forum and Search --> : ByVal and ByRef


efrat
Nov 13th, 2000, 07:20 AM
Hi My Friends

I have a big big Problem .

In ASP page i have ..CreatObject(Dllname )..

In VB I have function
private Function ppSet(InputMap As Map, OutputMap As Map) As Boolean

When i try that its fail i got TYPE MISMATCH

But if i change it to rivate Function ppSet(ByValInputMap As Map,ByVal OutputMap As Map) As Boolean ...its work ...

Why whaen i use ByRef its fail and when im use ByVal its work..
What the difference ? (In Object)

Thnsk
Efrat

Serge
Nov 13th, 2000, 09:07 AM
It's not because of ByRef or ByVal, but because of the parameter type. In VBScript, everything is VARIANT, so before you send the parameter, you have to convert it to a specific data type. In your case (I assume) you have a User Defined Type that works as a parameter and that's what causing the problem. Also, bare in mind that VBScript doesn't support User Defined Types.

The reason it works with ByVal is because DLL is working with the parameter that is not a reference, therefore, it treats it as a local variable (well sort of).

[Edited by Serge on 11-13-2000 at 10:09 AM]