Anel Hodžić
Anel Hodžić

Reputation: 313

vb6 to vb.net - Guids and classes

vb.net Object like this

<ComClass(WarrantyPrint.ClassId, WarrantyPrint.InterfaceId, WarrantyPrint.EventsId)>
Public Class WarrantyPrint

    Public Const ClassId As String = "3EEDF4AD-78CB-4D9B-8F38-149CA1914AE0"
    Public Const InterfaceId As String = "18343576-609A-473B-804D-03EB4E559FE8"
    Public Const EventsId As String = "390970DD-AABF-42BB-B9F6-6CB6BE5D7248"

    Public Sub initializing
        ' do smth
    End Sub  

    Public Class Towns
        Public Property NameTown As String = ""
        Public Property AddressTown As String = ""
    End Class

    Public Class ListTowns
        Public Property ListTowns() As New List(Of Towns)
    End Class

    Public Sub Add(t As Towns)
        tList.ListTowns.Add(t)
    End Sub
End Class

From vb6 i want to set this object like this

    Dim ob As Object
    Set ob = CreateObject("Company.Applicat3.laufer.WarrantyPrint")
        ob.Initializing 

    Dim X As Object
    Set X = CreateObject("Company.Applicat3.laufer.WarrantyPrint.towns")
        X.NameTown = "Test"
        X.AddressTown = "123"
        ob.Add (X)

        ob.Show

After this i get an error: activex component can't create object.

Surely i registered this dll under my machine. The proof of that is it show me an error on second object "x" with "ob" everything was fine.

I tried with naming GUID's and puting on the second class but the error is the same.

Upvotes: 0

Views: 117

Answers (2)

StayOnTarget
StayOnTarget

Reputation: 13037

In your class WarrantyPrint there is no class named Artikli. This would cause an error. Perhaps the code should use Towns instead.

Upvotes: 1

vincent163
vincent163

Reputation: 398

Maybe you mean Towns rather than Artikli (at the line Set X = CreateObject("Company.Applicat3.laufer.WarrantyPrint.Artikli")).

Upvotes: 0

Related Questions