DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: COM VARIANT from C#/ASP+

  1. #1
    Bruce Guest

    COM VARIANT from C#/ASP+


    I have imported (tlbimp) my "legacy" COM component
    and can call most functions - but how do I initialise
    a property that expects a VARIANT (SAFEARRAY of BSTR or int)
    and handle a return value from a function that is of type
    VARIANT (int or SAFEARRAY of BSTR)?

    Example:
    Tester oTest = new Tester(strConnection);
    oTester.Fields = {VARIANT};
    {VARIANT} = oTester.Read();

    many thanks
    Bruce

  2. #2
    Bruce Guest

    Re: COM VARIANT from C#/ASP+


    "Bruce" <bruce.jackson@update.com> wrote:
    >
    >I have imported (tlbimp) my "legacy" COM component
    >and can call most functions - but how do I initialise
    >a property that expects a VARIANT (SAFEARRAY of BSTR or int)
    >and handle a return value from a function that is of type
    >VARIANT (int or SAFEARRAY of BSTR)?
    >
    >Example:
    >Tester oTest = new Tester(strConnection);
    >oTester.Fields = {VARIANT};
    >{VARIANT} = oTester.Read();
    >
    >many thanks
    >Bruce


    Found the solution after much browsing in the Newsgroups:

    int [] FieldNums = new int [1];
    FieldNums[0] = 2;
    object oFields = (object)FieldNums;
    Tester.Fields = oFields;



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center