CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    1

    How to receive method "out" values from Vbscript

    I have a .NET class that I register (with regasm) as a
    COM object. It has a method that returns to caller an array of ints. I
    create that object from Vbscript and try to get the returned array,
    but get a runtime error.

    The .NET class (simplified):

    public class myclass {
    public myclass{
    ...
    }
    public int link(string ip){
    // no problem calling this method
    ...
    return 1;
    }
    public int getcounter(int param1, out ulong[] myarray){
    // can't call this method
    myarray = new ulong[2];
    myarray[0] = 0;
    myarray[1] = 1;
    return 1;
    }
    }

    The class is registred with regasm and called from vbscript as follows

    'this is test.vbs
    dim arr
    set myobj = CreateObject("myclass.myclass")
    ret = myobj.link("192.168.100.101")
    ret = myobj.getcounter(1, arr)

    Creation of the object and the call to "link" method works fine. The
    call to getcounter throws at vbscript exception 800A0005 "Invalid
    procedure call or argument: 'getcounter'"

    I guess this has to do with the "out" parameter, but I don't know how
    to make this work.

    Thanks,
    careta

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    check out the parameter type its not the same.

    Paresh
    - Software Architect

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured