|
 |
asp_components thread: How to Retrieve an array from a VB component
Message #1 by "Rene Henri Brosens" <rbrosens@m...> on Tue, 12 Jun 2001 14:27:30
|
|
Hello all,
I 'm having problems when I try to get back an array from a VB function of
my component. The array arrives, but I cannot access its elements. There
is my VB function:
Public Function ArrayBriefingGet() As Variant
ArrayBriefingGet = aBrief
End Function
And my ASP code (VBScript):
Dim aDados(), i
aDados = oBriefing.ArrayBriefingGet
For i = 0 to UBound(aDados)
Response.Write(aDados(i)) & "<BR>"
Next
The Ubound(aDados) function works fine but when I try to get the elements
from the array [aDados(i)] I get the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch
/testesight/Job/Brief/TabBrief.asp, line 107
Did anybody have the same problem or know what is happening? I'll
appreciate if you could help me.
Thanks, René.
Message #2 by Steve Driscoll <SteveD@D...> on Tue, 12 Jun 2001 14:37:09 +0100
|
|
try returning it as variant()
-----Original Message-----
From: Rene Henri Brosens [mailto:rbrosens@m...]
Sent: 12 June 2001 15:28
To: ASP components
Subject: [asp_components] How to Retrieve an array from a VB component
Hello all,
I 'm having problems when I try to get back an array from a VB function
of
my component. The array arrives, but I cannot access its elements.
There
is my VB function:
Public Function ArrayBriefingGet() As Variant
ArrayBriefingGet =3D aBrief
End Function
And my ASP code (VBScript):
Dim aDados(), i
aDados =3D oBriefing.ArrayBriefingGet
For i =3D 0 to UBound(aDados)
Response.Write(aDados(i)) & "<BR>"
Next
The Ubound(aDados) function works fine but when I try to get the
elements
from the array [aDados(i)] I get the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch
/testesight/Job/Brief/TabBrief.asp, line 107
Did anybody have the same problem or know what is happening? I'll
appreciate if you could help me.
Thanks, Ren=E9.
Message #3 by "Rene Henri Brosens" <rbrosens@m...> on Tue, 12 Jun 2001 15:21:01
|
|
Thanks Steve,
but my function is already returning as Variant. How do You mean exactly
when you say to try returning it as variant()?
Thanks again! Rene.
> try returning it as variant()
>
> -----Original Message-----
> From: Rene Henri Brosens [mailto:rbrosens@m...]
> Sent: 12 June 2001 15:28
> To: ASP components
> Subject: [asp_components] How to Retrieve an array from a VB component
>
>
> Hello all,
>
> I 'm having problems when I try to get back an array from a VB function
> of
> my component. The array arrives, but I cannot access its elements.
> There
> is my VB function:
>
> Public Function ArrayBriefingGet() As Variant
>
> ArrayBriefingGet =3D aBrief
>
> End Function
>
> And my ASP code (VBScript):
>
> Dim aDados(), i
> aDados =3D oBriefing.ArrayBriefingGet
> For i =3D 0 to UBound(aDados)
> Response.Write(aDados(i)) & "<BR>"
> Next
>
> The Ubound(aDados) function works fine but when I try to get the
> elements
> from the array [aDados(i)] I get the following error:
>
> Microsoft VBScript runtime error '800a000d'
>
> Type mismatch
>
> /testesight/Job/Brief/TabBrief.asp, line 107
>
> Did anybody have the same problem or know what is happening? I'll
> appreciate if you could help me.
>
> Thanks, Ren=E9.
>
Message #4 by Steve Driscoll <SteveD@D...> on Tue, 12 Jun 2001 15:17:37 +0100
|
|
try setting the return type to Variant() (ie variant array)
> Public Function ArrayBriefingGet() As Variant()
>
> ArrayBriefingGet =3D3D aBrief
>
> End Function
I think that's it - I'm not on my devel machine at the mo, so I can't
try it
out.
-----Original Message-----
From: Rene Henri Brosens [mailto:rbrosens@m...]
Sent: 12 June 2001 16:21
To: ASP components
Subject: [asp_components] RE: How to Retrieve an array from a VB
component
Thanks Steve,
but my function is already returning as Variant. How do You mean
exactly
when you say to try returning it as variant()?
Thanks again! Rene.
> try returning it as variant()
>
> -----Original Message-----
> From: Rene Henri Brosens [mailto:rbrosens@m...]
> Sent: 12 June 2001 15:28
> To: ASP components
> Subject: [asp_components] How to Retrieve an array from a VB
component
>
>
> Hello all,
>
> I 'm having problems when I try to get back an array from a VB
function =3D
> of=3D20
> my component. The array arrives, but I cannot access its elements.
=3D
> There=3D20
> is my VB function:
>
> Public Function ArrayBriefingGet() As Variant
>
> ArrayBriefingGet =3D3D aBrief
>
> End Function
>
> And my ASP code (VBScript):
>
> Dim aDados(), i
> aDados =3D3D oBriefing.ArrayBriefingGet
> For i =3D3D 0 to UBound(aDados)
> Response.Write(aDados(i)) & "<BR>"
> Next
>
> The Ubound(aDados) function works fine but when I try to get the =3D
> elements=3D20
> from the array [aDados(i)] I get the following error:
>
> Microsoft VBScript runtime error '800a000d'=3D20
>
> Type mismatch=3D20
>
> /testesight/Job/Brief/TabBrief.asp, line 107=3D20
>
> Did anybody have the same problem or know what is happening?
I'll=3D20
> appreciate if you could help me.
>
> Thanks, Ren=3DE9.
Message #5 by "Gerhard Wentink" <data@w...> on Tue, 12 Jun 2001 17:10:57 -0700
|
|
I think you have to Dim the elements of the array inside the function as
variant too, something like this:
Public Function ArrayBriefingGet() As Variant
Dim aBrief(2) as Variant
aBrief(0)=x1
aBrief(1)=x2
aBrief(2)=x3
ArrayBriefingGet = aBrief
End Function
Regards,
Gerhard Wentink
----- Original Message -----
From: "Rene Henri Brosens" <rbrosens@m...>
To: "ASP components" <asp_components@p...>
Sent: Tuesday, June 12, 2001 3:21 PM
Subject: [asp_components] RE: How to Retrieve an array from a VB component
> Thanks Steve,
>
> but my function is already returning as Variant. How do You mean exactly
> when you say to try returning it as variant()?
>
> Thanks again! Rene.
>
> > try returning it as variant()
> >
> > -----Original Message-----
> > From: Rene Henri Brosens [mailto:rbrosens@m...]
> > Sent: 12 June 2001 15:28
> > To: ASP components
> > Subject: [asp_components] How to Retrieve an array from a VB component
> >
> >
> > Hello all,
> >
> > I 'm having problems when I try to get back an array from a VB function
> > of
> > my component. The array arrives, but I cannot access its elements.
> > There
> > is my VB function:
> >
> > Public Function ArrayBriefingGet() As Variant
> >
> > ArrayBriefingGet =3D aBrief
> >
> > End Function
> >
> > And my ASP code (VBScript):
> >
> > Dim aDados(), i
> > aDados =3D oBriefing.ArrayBriefingGet
> > For i =3D 0 to UBound(aDados)
> > Response.Write(aDados(i)) & "<BR>"
> > Next
> >
> > The Ubound(aDados) function works fine but when I try to get the
> > elements
> > from the array [aDados(i)] I get the following error:
> >
> > Microsoft VBScript runtime error '800a000d'
> >
> > Type mismatch
> >
> > /testesight/Job/Brief/TabBrief.asp, line 107
> >
> > Did anybody have the same problem or know what is happening? I'll
> > appreciate if you could help me.
> >
> > Thanks, Ren=E9.
Message #6 by Kyle Burns <kburns@c...> on Wed, 13 Jun 2001 16:22:35 -0500
|
|
What he is saying is that you need to explicitly state that you are
returning an array. This is accomplished by using the () after
Variant.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D
Kyle M. Burns, MCP
Database Administrator/Webmaster
Centra Credit Union
kburns@c...
-----Original Message-----
From: Rene Henri Brosens [mailto:rbrosens@m...]
Sent: Tuesday, June 12, 2001 10:21 AM
To: ASP components
Subject: [asp_components] RE: How to Retrieve an array from a VB
component
Thanks Steve,
but my function is already returning as Variant. How do You mean
exactly
when you say to try returning it as variant()?
Thanks again! Rene.
> try returning it as variant()
>
> -----Original Message-----
> From: Rene Henri Brosens [mailto:rbrosens@m...]
> Sent: 12 June 2001 15:28
> To: ASP components
> Subject: [asp_components] How to Retrieve an array from a VB
component
>
>
> Hello all,
>
> I 'm having problems when I try to get back an array from a VB
function =3D
> of=3D20
> my component. The array arrives, but I cannot access its elements.
=3D
> There=3D20
> is my VB function:
>
> Public Function ArrayBriefingGet() As Variant
>
> ArrayBriefingGet =3D3D aBrief
>
> End Function
>
> And my ASP code (VBScript):
>
> Dim aDados(), i
> aDados =3D3D oBriefing.ArrayBriefingGet
> For i =3D3D 0 to UBound(aDados)
> Response.Write(aDados(i)) & "<BR>"
> Next
>
> The Ubound(aDados) function works fine but when I try to get the =3D
> elements=3D20
> from the array [aDados(i)] I get the following error:
>
> Microsoft VBScript runtime error '800a000d'=3D20
>
> Type mismatch=3D20
>
> /testesight/Job/Brief/TabBrief.asp, line 107=3D20
>
> Did anybody have the same problem or know what is happening?
I'll=3D20
> appreciate if you could help me.
>
> Thanks, Ren=3DE9.
Message #7 by "thenmalaiyandi vanmeeganathan" <tvalmiki@h...> on Thu, 14 Jun 2001 10:16:49 +0530
|
|
Hi,
Try this...
In VB ActiveX
--------------
Dim arrayVariable() As Variant
'And Do some Populating the array process in any other method
Public Function sendArray() As Variant()
sendArray = arrayVariable
End Function
In ASP
-------
Dim myObj, aspArray
Set myObj = Server.CreateObject("<Your Object.Your Class")
aspArray = myObj.sendArray
' Now all the elements of the array can be accessed....
Regards
T.Vanmeeganathan.
>From: Kyle Burns <kburns@c...>
>Reply-To: "ASP components" <asp_components@p...>
>To: "ASP components" <asp_components@p...>
>Subject: [asp_components] RE: How to Retrieve an array from a VB compo
>nent
>Date: Wed, 13 Jun 2001 16:22:35 -0500
>
>What he is saying is that you need to explicitly state that you are
>returning an array. This is accomplished by using the () after Variant.
>
>=================================
>Kyle M. Burns, MCP
>Database Administrator/Webmaster
>Centra Credit Union
>kburns@c...
>
>
>
>-----Original Message-----
>From: Rene Henri Brosens [mailto:rbrosens@m...]
>Sent: Tuesday, June 12, 2001 10:21 AM
>To: ASP components
>Subject: [asp_components] RE: How to Retrieve an array from a VB
>component
>
>
>Thanks Steve,
>
>but my function is already returning as Variant. How do You mean exactly
>when you say to try returning it as variant()?
>
>Thanks again! Rene.
>
> > try returning it as variant()
> >
> > -----Original Message-----
> > From: Rene Henri Brosens [mailto:rbrosens@m...]
> > Sent: 12 June 2001 15:28
> > To: ASP components
> > Subject: [asp_components] How to Retrieve an array from a VB component
> >
> >
> > Hello all,
> >
> > I 'm having problems when I try to get back an array from a VB function
>
> > of
> > my component. The array arrives, but I cannot access its elements.
> > There
> > is my VB function:
> >
> > Public Function ArrayBriefingGet() As Variant
> >
> > ArrayBriefingGet =3D aBrief
> >
> > End Function
> >
> > And my ASP code (VBScript):
> >
> > Dim aDados(), i
> > aDados =3D oBriefing.ArrayBriefingGet
> > For i =3D 0 to UBound(aDados)
> > Response.Write(aDados(i)) & "<BR>"
> > Next
> >
> > The Ubound(aDados) function works fine but when I try to get the
> > elements
> > from the array [aDados(i)] I get the following error:
> >
> > Microsoft VBScript runtime error '800a000d'
> >
> > Type mismatch
> >
> > /testesight/Job/Brief/TabBrief.asp, line 107
> >
> > Did anybody have the same problem or know what is happening? I'll
> > appreciate if you could help me.
> >
> > Thanks, Ren=E9.
|
|
 |