.NET2005 byte array in VB6

S

Si

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(ByVal Data() As Byte)

End Sub

Can Anyone help ?


Thanks
 
N

Nick Hall

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
 
S

Si

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

Thanks

Nick.
 

Ask a Question

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. After that, you can post your question and our members will help you out.

Ask a Question

Top