Array as vb com property - asp problem

Results 1 to 2 of 2

Thread: Array as vb com property - asp problem

  1. #1
    Join Date
    Dec 1969

    Default Array as vb com property - asp problem

    I have found a few articals about passing arrays into COM but I am having a problem the other way. <BR><BR>My VB object has a property that returns a single dimensioned array. When I test my com in VB I have no problems. When I call my object from ASP I get a "type mismatch" error: <BR><BR>set qs = server.createobject("myLib.blahblah") <BR>[...set some db params...] <BR>qs.refresh &#039;loads up the properties <BR><BR>&#039;grab local copies of the arrays <BR>aLables = qs.lables <BR>aValues = qs.values <BR><BR>response.write isArray(aLables) &#039;returns true <BR>response.write lbound(aLables) &#039;returns 0 <BR>response.write ubound(aLables) &#039;returns 9 <BR>response.write typename(aLables) &#039;returns String() <BR><BR>response.write aLables(0) &#039; returns type mismatch error ?? <BR><BR>I have tested using the same array contents in VB and it works fine. <BR><BR>Any ideas? <BR><BR>The vb COM code is :<BR>Private mvarLables as variant<BR><BR>Public Property Let lables(ByVal vData As Variant)<BR> mvarLables = vData<BR>End Property<BR><BR>Public Property Set lables(ByVal vData As Variant)<BR> Set mvarLables = vData<BR>End Property<BR><BR>Public Property Get lables() As Variant<BR> If IsObject(mvarLables) Then<BR> Set lables = mvarLables<BR> Else<BR> lables = mvarLables<BR> End If<BR>End Property<BR><BR>Thanks in advance for any ideas at all :),<BR>David Chisholm <BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Array as vb com property - asp problem

    Well, I belive this will solve your prob.<BR><BR>The line u are getting error u are transfering values from component to asp. use typecasting / convert variable in asp pages for example<BR>if u are using string variable then use Cstr() function or Cint() Cdbl() <BR><BR>a = yourobj.somevalue (wrong)<BR><BR>a = cint(yourobj.somevalue) (use this acording your variable int/str/dbl)<BR><BR><BR>thats all <BR><BR>enjoy happy scripting<BR>A.Ali<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts