Long story short – sort of; our company is looking for a migration path from our legacy VB6 applications (logic) to DotNet. We are currently implementing CLSA 2.1.4-070223 in our DotNet applications and looking for a way to share the same assembly for both DotNet and VB6 (GUI) consumption. After converting the back-end logic we will look at rewriting the GUI layer.
The ‘Register for COM interop’ option on the ‘compile’ tab is checked in the DotNet business object assembly and we are able to reference the type library (tlb) in VB6. However, when attempting to retrieve the value of a ‘readable’ property we receive a 438 run-time error ‘Object doesn’t support this property or method’. If the class doesn’t inherit from a CSLA base business object the property is accessible from VB6. Our guess -- it’s VB6’s inability to handle generics which is causing the problem. The strong name file provided with csla is being used. Can anyone provide a definitive answer to whether this is the case and how share opinions on experienced migration paths from legacy VB6 applications.
Not able to access FirstName from COM application (438 run-time error when called from VB6)
Public Class cPerson
Inherits Csla.BusinessBase(Of cPerson)
Dim mFirstName As String = ""
Dim mLastName As String = ""
Dim mId As Integer
Public Property FirstName() As String
' tried commenting out to work from VB6 -- didn't work
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Get
' tried commenting out to work from VB6 -- didn't work
CanReadProperty(True)
Return mFirstName
End Get
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Set(ByVal value As String)
CanWriteProperty(True)
If Not mFirstName.Equals(value) Then
mFirstName = value
PropertyHasChanged()
End If
End Set
End Property
…
Able to access FirstName from COM application:
Public Class Person
Private mFirstName As String = String.Empty
Private mLastName As String = String.Empty
Public Sub New(ByVal FirstName As String, ByVal LastName As String)
mFirstName = FirstName
mLastName = LastName
End Sub
Public Property FirstName() As String
Get
Return mFirstName
End Get
Set(ByVal value As String)
mFirstName = value
End Set
End Property
…
It could be generics, but that seems like a long shot. The reason I say this, is because your actual type (the type VB6 sees) is not generic.
It is more likely that Csla.dll isn't being found or something like that.
Remember that COM has a global view of the system - it isn't folder-specific - it finds components via the registry.
.NET however, is folder-specific by default - it finds assemblies by looking in a specific folder path - namely the one containing the EXE file.
You can try putting Csla.dll into the GAC - that makes it more like COM in that it is in a system-wide location.
You could also make sure that your business DLL and Csla.dll are in the same directory as your VB6 EXE, and that the business DLL is registered with COM as being in that location.
Copyright (c) Marimer LLC