Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2008

Tip: Looking for answers? Try searching our database.

Passing a simple structure from VB6 to VB.Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bully - 12 Mar 2008 05:09 GMT
Hi

I have created a simple COM Class in VB.Net containing a simple
structure and function:

Public Structure MyStruct
       Dim Param1 As Byte
End Structure

Public Function ShowStruct(ByRef MyPassedStruct As MyStruct)

   ' Do nothing

End Function

In VB6, I want to call the .Net function and pass the structure.

Public Type MyStruct
       Param1 As Byte
End Type

Private Sub Command1_Click()
   Dim netCall as New netDll
   Dim testStruct as MyStruct

   testStruct.Param1 = 10

   Call netCall.ShowStruct(testStruct)

End Sub

When I try and comple my VB app it gives me an error saying 'ByRef
Argument Mismatch'.  What am I doing wrong?

I have managed to pass integers and strings ok, I'm just having a
problem with structures.

Thanks
Jon
TDC - 24 Mar 2008 14:41 GMT
VB doesn't know that the VB6 MyStruct you declared is compatible with
the .NET MyStruct you declared.  It wants them to be of the eaxct same
type.

> Hi
>
[quoted text clipped - 35 lines]
> Thanks
> Jon

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.