Re: Type mismatch calling a COM object developed in vb6



<wolfing1@xxxxxxxxx> wrote in message
news:1139859723.501094.38100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I created a COM object in VB6, but when I call it from ASP it gives me
a type mismatch error. It's weird, let's say the function in the COM
object is:
public function test(a as string)
...
end function

From vbscript (ASP), if I call it like this:
response.write obj.test("test string")
It works.

But if I call it like:
dim k
k = "test string"
response.write obj.test(k)
It gives me a type mismatch.

Should I define the functions in the COM object without an explicit
type? like
public function test(a)

WHen your COM component is to be consumed by .ASP, *all* parameters
in public menthods *must* be passed 'ByVal'.

And no, you should declare them with type.

Just Change your function to :
public function test(ByVal a as string)

and recompile, and all will be fine...

--
Dag.


.



Relevant Pages