Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VBScript arrays

  • 15-05-2001 03:08PM
    #1
    Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭


    I'm calling a method in a COM Interface that returns a safearray, from an ASP page. VB sees this as type Object but treats it like a normal array. The problem is in VBScript this doesn't happen.

    Here's the Code:
    [code]
    <%
    dim msgMgr
    dim objXIRMsg()

    set msgMgr=server.createobject("XIRLib.XIRMessageManager")
    '// Call that returns the safearray
    objXIRMsg = msgMgr.getMessages
    %>

    Right, so in Visual Basic this would work but in VBSCript it throws a Type Mismatch error (error number 800a000d). If I include the paranthesis I get a subscript out of range error, obviously.

    The return type of the called method has to be safearray as it's coded in Java. (This is being done as customers have asked for a COM interface to our software)

    Am I doing this wrong or is there another way of doing this?


Comments

  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    Hmmmm if its an array you should be fine by just doing something like the below
    &lt;%
      dim msgMgr
      dim vXIRMsg 'note leave off the ()
      ..
      ..
      vXIRMsg = msgMgr.getMessages
    
    %&gt;
    
    

    we use variants a good bit and we use them for arrays or single values. I can't see why it wouldn't work for you.

    kayos


    When you get to hell tell them I sent you,
    you'll get a group discount...

    tribes.gameshop.ie


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    That worked, thanks Kayos.


  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    Hmmm though so ahhhh I am the master of VB muppets biggrin.gif

    kayos

    When you get to hell tell them I sent you,
    you'll get a group discount...

    tribes.gameshop.ie


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Okay then Kayos, what's the answer to http://www.boards.ie/bulletin/Forum19/HTML/000181.html ?
    I think I have it BTW, but want to test it before I post the solution.


Advertisement