Jag försöker att göra en com.tlb ifrån en .net class enligt:
http://www.codeproject.com/vb/net/MusaExposingCOM.asp
Jag har kört den i regasm osv utan problem.
Allt går bra tills jag skall köra den i vb6 då jag får "Automation error -2147024894".
I minclass.vb
Imports System.Runtime.InteropServices
<Guid("32D6721D-062C-454a-A786-FDE9CB733FAB"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _demo
<DispId(1)> Function Concat(ByVal s1 As String, ByVal S2 As String) As String
<DispId(2)> ReadOnly Property ErrorMsg() As String
End Interface
<Guid("EFFFC0FA-648C-487f-8BDF-3F394F169B35"), _
ClassInterface(ClassInterfaceType.None), ProgId("comDemo.demo")> _
Public Class demo : Implements _demo
Private csError As String ' stores the error message
Public ReadOnly Property ErrorMsg() As String Implements _demo.ErrorMsg
Get
Return csError
End Get
End Property
Public Function Concat(ByVal str1 As String, ByVal str2 As String) As String Implements _demo.Concat
Return str1 & " " & str2 & " Tid: " & Now().ToString
End Function
End Class
I vb6:
Set obj = CreateObject("comDemo.demo")
MsgBox (obj.concat("Ett", "Två"))
Vad är fel?