Re: Type mismatch calling a COM object developed in vb6
- From: "Dag Sunde" <dag@xxxxxx>
- Date: 15 Feb 2006 19:35:08 +0100
<wolfing1@xxxxxxxxx> wrote in message
news:1140017091.779500.182890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Dag Sunde wrote:
<spkelly@xxxxxxxxxxxxx> wrote in messageThanks all for your responses. I changed the function declaration to
news:1139947917.518866.101060@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Michael B. Johnson wrote:As I have posted earlier in this thread...
On Mon, 13 Feb 2006 19:46:49 GMT, "Veign" <NOSPAMveign1@xxxxxxxxx>
wrote:
Did you try:
response.write obj.test(cstr(k))
Chris is right: the OP's problem is that he needs to cast the variant
in
the ASP
page to the string type expected by the VB procedure.
Couldn't he also just change the dim statement to
dim k as string
cstr(x) is probably safer...
just curious
If you want to call a method in a VB Com component from
an .ASP page, all the parameters for that method *must*
be declared By Value in the component:
public function test( ByVal a as string)
... ^^^^^
end function
--
be all variants and it works.
But what you said above is boggling. Do you mean I can't pass
parameters to .COM objects by reference? In another COM object I'm
writing right now (haven't tested yet), I was passing parameters
(byref) that were going to be filled out by the COM object, do you mean
I can't do that? How would I do that if all parameters must be passed
Byval?
Declare a class with all the public properties you'll need,
and use an instance of that class as a returnvalue from
your function...
Public class CUser
Public Name as string
Public Phone as string
Public Age as long
....
In your function:
Public function getUser(byVal userId as long) as CUser
....
' get all userdata...
getDataFromId(userId)
Dim oUser as CUser
Det oUser = New CUser
oUser.Name = blablaName
oUser.Phone = blablaPhone
oUser.Age = BalAge
Set getUser = oUser
End Function
In .Asp
Dim o
Set o = Server.CreateObject("Comp.Class")
Dim oUser
Set oUser = o.getUser(12)
Response.Write oUser.Name
Response.Write oUser.Phone
Response.Write oUser.Age
....
(...Or something like that...)
--
Dag.
.
- Follow-Ups:
- Re: Type mismatch calling a COM object developed in vb6
- From: wolfing1
- Re: Type mismatch calling a COM object developed in vb6
- References:
- Type mismatch calling a COM object developed in vb6
- From: wolfing1
- Re: Type mismatch calling a COM object developed in vb6
- From: Veign
- Re: Type mismatch calling a COM object developed in vb6
- From: Michael B . Johnson
- Re: Type mismatch calling a COM object developed in vb6
- From: spkelly
- Re: Type mismatch calling a COM object developed in vb6
- From: Dag Sunde
- Re: Type mismatch calling a COM object developed in vb6
- From: wolfing1
- Type mismatch calling a COM object developed in vb6
- Prev by Date: Re: Application blocks...
- Next by Date: Re: Application blocks...
- Previous by thread: Re: Type mismatch calling a COM object developed in vb6
- Next by thread: Re: Type mismatch calling a COM object developed in vb6
- Index(es):
Relevant Pages
|