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?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
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:
    841
    Peter Huang
    Nov 19, 2003
  2. Guest

    VB.NET variant arrays

    Guest, Jan 26, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    542
    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:
    751
    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:
    477
    Cor Ligthert
    Feb 27, 2005
  5. Michael Moreno

    [Upgrade vb6 COM to .Net] - Problem with Variant and Arrays

    Michael Moreno, Mar 3, 2005, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    447
    Michael Moreno
    Mar 3, 2005
  6. Douglas Marquardt

    ComInterop: VB6 Com Interface object = VB6 Com object fails

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