Click here to Skip to main content
15,178,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello good people,

I really need your help on this one which drives me crazy...I searched the net a lot but couldn't find the answer that works for me. I have written a basic .dll in vb.net (VS2010) that consumes a web service. I followed everything according to http://support.microsoft.com/kb/817248[^]
I built the project with Register for COM Interop checked and com visible=true. I copied the .dll , the tlb file and .config file to the folder of the vb6 project - in the same development computer. I ran the vb6 project and got "automation error". I also tried to register it manually using regasm (in command prompt as administrator) but it didn't help. Few notes, maybe important:
1. I got a warning - Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)] etc...but again in the example above by microsoft they didn't use it and also when I did try to add it like this:
<comclass(comclass1.classid,> _
<classinterface(classinterfacetype.none)>
Public Class ComClass1
I got an error that both attributes can not be applied to the same class. Maybe I just don't write it well but I haven't seen any examples combining both. I assume that I also have to explicitly define an interface and so but this all subject is not clear to me, I would be happy to see an example.
2. during my trails I got also "error 429. ActiveX component can't create object" but now I don't succeed to reproduce it...
Sorry for the long question I am just trying to give you the whole picture...
Thanks a lot in advance, it is a lifesaver
Posted
Updated 18-Sep-13 6:52am
v2
Comments
Sergey Alexandrovich Kryukov 18-Sep-13 12:34pm
   
What makes you torturing yourself will all that old lame, VB6 and ActiveX? Why not throwing it all out? Honestly...
—SA
Bernhard Hiller 19-Sep-13 2:47am
   
Could you show us the code of ComClass1 - at least the signatures of its public functions and properties. Likely one of them causes the problems.
g77777 19-Sep-13 3:20am
   
THanks for your comments. I get the error on creating the object(set obj = new wcf_reader.ComClass1) - before I call any of the functions. Anyway this is comclass1:
Public Class ComClass1

#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 = "6ee7814e-c751-4cf2-ad57-1803100418a1"
Public Const InterfaceId As String = "0d94e1ff-c5f4-4249-8755-718d74d292f1"
Public Const EventsId As String = "f2d74c03-d599-4f31-b650-95a46b8c7195"
#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 client As ServiceReference3.TouristVisitClient
Private returnString() As String


Public Sub New()
MyBase.New()
client = New ServiceReference3.TouristVisitClient

End Sub

Public Function my_get_tayarByBarCode(ByVal barCode As String) As String

' some code here

Public Function my_update_BikurTayar_Inbal(ByVal bar_code As String, ByVal branch As Integer, ByVal cash_reg As Long, ByVal transID As Long, ByVal sup_number As String) As String
' some code here

Public Function my_get_tayarByPassport(ByVal country As String, ByVal pass_number As String) As String

' some code here

Public Sub DisplayAll(ByVal Someobject As Object)
' some code here

thanks again
Bernhard Hiller 19-Sep-13 6:02am
   
"Public client As ServiceReference3.TouristVisitClient"
is TouristVisitClient also a COM Class? If not, make it a COM class.
g77777 19-Sep-13 6:18am
   
Thank you Bernard for this answer and also the previous one - it led me to same conclusion that you just wrote that the problem lays in the web service issue. So now I hope you forgive me for my ignorance (and "laziness" - as I have already spent so much time on this) - how do I make it a com class? is it my job or the web service owner's job? maybe I can write a com class client that inherits the original TouristVisitClient?
thank you very much again
Bernhard Hiller 19-Sep-13 8:29am
   
If you really need that property public and pass it thru COM, I'd suggest to write some "wrapper" class for it which just forwards the calls to its internal object of that type; and your wrapper class must be a COM class. If other non-trivial objects are involved, wrap them the same way - that's very tedious, but I do not know of an easier solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900