Possible to pass object from vb.net program to vb6 executable?

Is there any way to pass an object from a vb.net program to a vb6 executable. I am currently passing some data in command line parameters to it, but I would like to pass in the whole "customer" object because I have made it an interop class and so the same class exists in the vb6 project. I could then just set the vb6 object equal to the passed in object from dotnet and be on my way.

thanks,
Bruce Mutch
bmutchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bmutchAuthor Commented:
Ok, I see that that was a stupid question. I have changed the VB6 program to a dll, added the .net classes that I need to pass to it as dll's in the vb6 program, and call the vb6 dll from the .net program, passing it the objects. The problem I have now it that a top level object is getting passed ok, wheras a child object inside that object is not making it into the vb6 program. Any ideas?

thanks.
0
bmutchAuthor Commented:
To explain further, I have a Customer object and a child ReportCollection object in dotnet that I can access fine. When I pass the Customer object to the vb6 dll, the child ReportCollection object is "Nothing": here is the code for the child object ReportCollection:

( do you think the problem is due to the "Inherits Hashtable". I had to use this so I could refer to the report objects in the ReportCollection by string keys)

<ComClass(ReportCollection.ClassId, ReportCollection.InterfaceId, ReportCollection.EventsId)> _
Public Class ReportCollection
    Inherits Hashtable

#Region "COM GUIDs"
    ' These  GUIDs provide the COM identity for this class
    ' and its COM interfaces. If you change them, existing
    ' clients will no longer be able to access the class.

    Public Const ClassId As String = "22CB3A25-EE3F-41bb-8B20-FE6E414BA372"
    Public Const InterfaceId As String = "2B8026B3-7E25-4014-8AD5-6775A6C351D2"
    Public Const EventsId As String = "2BA1C216-DA58-4531-8211-DD02FBFB5D92"
#End Region
    'Inherits NameValueCollection
    'Inherits CollectionBase
    Public Sub New()
    End Sub

    Default Public ReadOnly Property GetItem(ByVal Index As Object) As Report
        Get
            Return CType(Me.Item(Index), Report)
        End Get
    End Property

    Public Sub AddReport(ByVal _Item As Report)
        Me.Add(_Item.Name, _Item)
    End Sub

End Class
0
bmutchAuthor Commented:
changed the collection class code and it works perfectly now.

<ComClass(ReportCollection.ClassId, ReportCollection.InterfaceId, ReportCollection.EventsId)> _
Public Class ReportCollection
    Private mCol As Collection

#Region "COM GUIDs"
    ' These  GUIDs provide the COM identity for this class
    ' and its COM interfaces. If you change them, existing
    ' clients will no longer be able to access the class.
    Public Const ClassId As String = "BCECC526-BC69-415C-8F1A-2F1CBB1D0F50"
    Public Const InterfaceId As String = "5C76AB26-729D-4E32-8AC1-5A19E494ADCE"
    Public Const EventsId As String = "CB1884B0-9B7C-4049-BC10-034A0512A196"
#End Region

    ' A creatable COM class must have a Public Sub New()
    ' with no parameters, otherwise, the class will not be
    ' registered in the COM registry and cannot be created
    ' via CreateObject.
    Public Sub New()
        MyBase.New()
        mCol = New Collection()
    End Sub

    Public Sub Add(ByVal oItem As Report, ByVal sKey As String)
        mCol.Add(oItem, sKey)
    End Sub

    Public Sub Remove(ByVal sKey As String)
        Try
            mCol.Remove(sKey)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Default Public ReadOnly Property Item(ByVal Index As String) As Report
        Get
            Return mCol(Index)
        End Get
    End Property

    Public Function GetEnumerator() As System.Collections.IEnumerator
        'return our internal collection's IEnumerator.
        'COM calls this function when the collection is enumerated using the For-Each syntax
        Return mCol.GetEnumerator
    End Function

End Class
0
EE_AutoDeleterCommented:
bmutch,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.