.NET2005 byte array in VB6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Si

    #1

    .NET2005 byte array in VB6

    Hi,
    I have a DLL written in VB.NET(2005) and it has a public event that
    passes a byte array, when I try and use the event in VB6 I get this
    message box when trying to run the app.

    ---------------------------
    Microsoft Visual Basic
    ---------------------------
    Function or interface marked as restricted, or the function uses an
    Automation type not supported in Visual Basic
    ---------------------------
    OK Help
    ---------------------------

    I had the same problem when using a .NET long as a property of the DLL,
    I know I need to define it as something else but I don't know what.

    Heres the declaration in .NET
    Public Event DataOut(ByVal Data() As Byte)

    heres the Subroutine in VB6
    Private Sub Audio_DataOut(B yVal Data() As Byte)

    End Sub

    Can Anyone help ?


    Thanks
  • Nick Hall

    #2
    Re: .NET2005 byte array in VB6

    VB6 does not support passing arrays ByVal. To make this work, you need to
    change your event declaration to : -

    Public Event DataOut(ByRef Data() As Byte)

    It should then work.

    Regards,

    Nick Hall


    Comment

    • Si

      #3
      Re: .NET2005 byte array in VB6

      I had to recompile the DLL using ByRef in the event declaration as well,
      but it now works like a charm.

      Thanks

      Nick.



      Nick Hall wrote:
      VB6 does not support passing arrays ByVal. To make this work, you need to
      change your event declaration to : -
      >
      Public Event DataOut(ByRef Data() As Byte)
      >
      It should then work.
      >
      Regards,
      >
      Nick Hall
      >
      >

      Comment

      Working...