Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VBScript arrays

Options
  • 15-05-2001 3:08pm
    #1
    Registered Users 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 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 Posts: 7,468 ✭✭✭Evil Phil


    That worked, thanks Kayos.


  • Registered Users 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