PRB: Passing Parameters By Reference to a VB COM ObjectID: Q197956
|
When passing a parameter to a COM Component's method in Active Server Pages
(ASP), the following error occurs:
Microsoft VBScript runtime error '800a000d' Type mismatch
VBScript will pass parameters to a method by value if the argument's data type is NOT declared as a variant and the parameter is passed by reference if the argument's data type is declared as variant by the method.
Parameters to be passed by reference to a method should always be declared as a variant data type by the method, while parameters to be passed by value can be declared as any type by the method.
This behavior is by design.
Public Sub ByRefMethod( ByRef strVal as String )
strVal = "This variable is passed by Reference"
End Sub
<%
Dim objTest, strByRefVal
Set objTest = Server.CreateObject("ByRefProj.ByRefObj")
objTest.ByRefMethod strByRefVal
%>
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'ByRefMethod'
Additional query words:
Keywords : kberrmsg kbASP kbCOMt KbVBA kbVBp600 kbVBScript kbGrpASP
Version : WINDOWS:5.0,6.0; WINNT:
Platform : WINDOWS winnt
Issue type : kbprb
Last Reviewed: May 25, 1999