How to expose a structure to VB6 from VB.NET?

  • Thread starter Thread starter Peter van der Veen
  • Start date Start date
P

Peter van der Veen

Hi

I have a VB.net apllication (DLL) with a structure and a property get.

public structure tMyCode
dim iCode as integer
dim sText as string
end structure

writeonly property GetCodes as tMycode
get
dim a(0) as tMycode
a(0).icode=10
a(0).sText = "text"
return a
end get
end property



I can see these this in VB6 (using comvisible), but got an error when
assigning it in vb6

dim a as tMycode

This raises an error (Variable uses an automation type not supported.

We can't use types in VB.net, but how can i get those in VB6?

I hope my problem is clear.

Peter
 
Peter,

Is this not more a question for a VBCom newsgroup.

microsoft.public.vb.general.discussion

That last is the most active one.

Cor
 
Don't think so, but i'll try

I think i'm doing something wrong in VB.NET.
 
Hi,

Perhaps this will get you going:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnhcvb04/html/vb04g9.asp

If you have done that... I am not sure. Perhaps you will need to wrap the
"type" as a class, not a structure.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
 
Back
Top