Variant in VB6 to a VB.NET

Discussion in 'Microsoft VB .NET' started by John, Jul 26, 2004.

  1. John

    John Guest

    Hi,

    I have an COM object used in my VB.NET project. There's one function return
    the result in Variant type so I have to convert it to object type.

    Dim myValue as object

    myValue = MyCOMobjectFunction

    If I want to get value out of the myValue, I have to do this: myResult =
    MyValue(0)

    How can I convert it to dataset or something in VB.NET type?

    Please help. Thanks
     
    John, Jul 26, 2004
    #1
    1. Advertisements

  2. John

    rawCoder Guest

    Hi John,

    You may try CType or DirectCast.
    Or if the Option Strict is set to Off , then i think you can just use =

    Thank You,
    rawCoder

    "John" <> wrote in message
    news:...
    > Hi,
    >
    > I have an COM object used in my VB.NET project. There's one function

    return
    > the result in Variant type so I have to convert it to object type.
    >
    > Dim myValue as object
    >
    > myValue = MyCOMobjectFunction
    >
    > If I want to get value out of the myValue, I have to do this: myResult =
    > MyValue(0)
    >
    > How can I convert it to dataset or something in VB.NET type?
    >
    > Please help. Thanks
    >
    >
    >
     
    rawCoder, Jul 26, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Gregory Hassett

    Passing a VB.NET Array as a VARIANT to a COM Server

    Gregory Hassett, Nov 18, 2003, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    1,004
    Peter Huang
    Nov 19, 2003
  2. Guest

    VB.NET variant arrays

    Guest, Jan 26, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    621
    Guest
    Jan 26, 2004
  3. Jim Johnston

    Problem converting VB6 Variant array to object

    Jim Johnston, Mar 12, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    796
    Jim Johnston
    Mar 12, 2004
  4. Alan M Dunsmuir

    A variant of the DateTime data type needed in VB.NET

    Alan M Dunsmuir, Feb 26, 2005, in forum: Microsoft VB .NET
    Replies:
    13
    Views:
    534
    Cor Ligthert
    Feb 27, 2005
  5. Douglas Marquardt

    ComInterop: VB6 Com Interface object = VB6 Com object fails

    Douglas Marquardt, Mar 22, 2006, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    813
    Douglas Marquardt
    Mar 22, 2006
  6. Ruth
    Replies:
    3
    Views:
    705
    Herfried K. Wagner [MVP]
    Aug 18, 2006
  7. SAL
    Replies:
    3
    Views:
    8,607
    Cor Ligthert[MVP]
    Dec 19, 2007
Loading...