473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot create ActiveX component

I have a windows app. written in VB6, now we need to expose some of
its classes through a web service.

I am only able to expose the classes using late binding becasue that's
the way the original VB6 was written. I ahve already exposed some of
the original classes, and they work fine. Now, I added a new ActiveX
component to the windows app (in vb6). I am able to call it by late
binding from within the vb6 app. itself, and from a dummy vbs file
(visual basic script), but it crashes when I tried to call it from a
simple <WebMethod> in VB.NET:

<WebMethod()> Public Function PostPaymentToServer(ByVal
TCMPaymentTransactionID As Long) _
As PostPayment
Dim obj As Object
'Dim objPost As New TCMPostPayments.clsPostPaymentBDS
Dim blnRet As Boolean
Dim objRes As New PostPayment

blnRet = False
Try
obj = CreateObject("TCPostPayment.clsPostPaymentBDS")
blnRet = obj.AcceptPayment(TCMPaymentTransactionID)
'blnRet = objPost.AcceptPayment(TCMPaymentTransactionID)
If blnRet = True Then
objRes.ErrorString = ""
Else
objRes.ErrorString = obj.ErrorMessage
End If
Catch ex As Exception
objRes.ErrorString = "Error: " + ex.ToString
Finally
obj = Nothing
End Try

Return objRes
End Function

I get this:

Error: System.Exception: Cannot create ActiveX component. at
Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
ServerName) at TaxCollectionWS_BS.WebService.PostPaymentToServer( Int64
TCMPaymentTransactionID) in
C:\TaxCollectionWeb\TaxCollectionWS\TaxCollectionW S_BS\WebService.vb:line
251

any ideas why?
line 251 is the CreateObject line, from there it goes straight to
Catch ex.

The point is: I can use late binding call on this COM object from
another VB6 app, from a VBS script, but not from my web service app.
Nov 21 '05 #1
1 15524
I have exactly the same problem with my C# web service, which is attempting
to create an ActiveX-component. When I try to call it from within C# as an
ordinary application, it works fine, but when I invoke the web method from
another application, it crashes. I get a
System.Runtime.InteropServices.COMException. I have a catch-clause which
catches the COM-exception when called from within the application, but for
some reason it seems to ignore this when called from another application.
That said, there is no reason why the exception should be thrown in the first
place, as I provide the correct information to the method. I deliberately
sent it null-values from within the application just to test the
catch-clause, which then worked fine.

Did you find out why this happened? Or perhaps a work-around? I would be
very happy to hear from you if you did.

"Rocio" wrote:
I have a windows app. written in VB6, now we need to expose some of
its classes through a web service.

I am only able to expose the classes using late binding becasue that's
the way the original VB6 was written. I ahve already exposed some of
the original classes, and they work fine. Now, I added a new ActiveX
component to the windows app (in vb6). I am able to call it by late
binding from within the vb6 app. itself, and from a dummy vbs file
(visual basic script), but it crashes when I tried to call it from a
simple <WebMethod> in VB.NET:

<WebMethod()> Public Function PostPaymentToServer(ByVal
TCMPaymentTransactionID As Long) _
As PostPayment
Dim obj As Object
'Dim objPost As New TCMPostPayments.clsPostPaymentBDS
Dim blnRet As Boolean
Dim objRes As New PostPayment

blnRet = False
Try
obj = CreateObject("TCPostPayment.clsPostPaymentBDS")
blnRet = obj.AcceptPayment(TCMPaymentTransactionID)
'blnRet = objPost.AcceptPayment(TCMPaymentTransactionID)
If blnRet = True Then
objRes.ErrorString = ""
Else
objRes.ErrorString = obj.ErrorMessage
End If
Catch ex As Exception
objRes.ErrorString = "Error: " + ex.ToString
Finally
obj = Nothing
End Try

Return objRes
End Function

I get this:

Error: System.Exception: Cannot create ActiveX component. at
Microsoft.VisualBasic.Interaction.CreateObject(Str ing ProgId, String
ServerName) at TaxCollectionWS_BS.WebService.PostPaymentToServer( Int64
TCMPaymentTransactionID) in
C:\TaxCollectionWeb\TaxCollectionWS\TaxCollectionW S_BS\WebService.vb:line
251

any ideas why?
line 251 is the CreateObject line, from there it goes straight to
Catch ex.

The point is: I can use late binding call on this COM object from
another VB6 app, from a VBS script, but not from my web service app.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pat | last post by:
A97, WinXP Hello, I am looking for a way to create a task (in the windows task scheduler) from an Access MDB using VBA. I found this great DLL: ...
3
by: DB | last post by:
Hi Folks, I want to create Activex component. Can we create it using c#.net or do I need to create it using vc++? Thanks in Advanced, Deepak
1
by: Zhou Jingxiong | last post by:
Hi I am using third party COM component which come with an installation program (.exe file included). The program will be register to registry automatically upon installation. There is no...
2
by: W. Broersen | last post by:
I want to use Outlook.Application, but I donot get further. Dim objOLApp As Outlook.Application objOLApp = CreateObject("Outlook.Application") Everytime I'll get the following error: Cannot...
6
by: Steve Richter | last post by:
I am getting error in a vbscript: ActiveX component cant create object: Excel.Application. The vbscript code is: Dim objExcel Set objExcel = CreateObject("Excel.Application") I am pretty...
0
by: Andrew Luke | last post by:
Hi There, I'm trying to get a listing of shares from a server. The server is a linux box running samba and LDAP for directory services (just for background info!) I have some code which I...
2
by: Shlomi | last post by:
Hi, I'm developing an application that runs in AspNet on Win2003 server. Every thing runs OK in the development environment, but in the customer site I have a problem running...
16
by: Heinz K | last post by:
Hello all, I'm developing a vb.net 2.0 webservice which accesses a lotus notes database using lotus domino api. This works fine on my local client if I select "Use Visual Studio Development...
0
by: rrotstein | last post by:
I took a simple VB 6.0 .dll project, consisting of a single form, and used Vistual Studio 2005 to upgrade it and create a new solution. I then registered it and created a type library using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.