Link to home
Start Free TrialLog in
Avatar of collages
collagesFlag for United States of America

asked on

Using a COM with VB.Net

I am trying to use a COM with VB.Net and it sounds like I need to create a "wrapper" to use it.I read the article here:

http://www.csharphelp.com/archives2/archive437.html

but Im still having problems.  When I go to the command prompt and try to run  tlbimp.exe it doesnt work.  When I type in "tlbimp" it says "'tlbimp' is not recognized as an internal or external command, operable program or batch file".  I do however have it on my machine.

HEre is the code I am running in my program, which is generating COM exceptions.  

Imports System
Imports busobj
Imports System.Runtime.InteropServices

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim BusObjApp As New busobj.Application
        Dim BusObjRep As New busobj.Report

When I try to create the new business objects report I get the COM exception.

"Retrieving the COM class factory for component with CLSID {2AE0D397-5F2A-11D0-8B75-0000C0FDEBE3} failed due to the following error: 80040154."

I've been stuck on this for a while now....and ideas would be greatly appreciated.


Avatar of Bob Learned
Bob Learned
Flag of United States of America image

1) What version of 2005 do you have?  Express Edition, Professional, Team Suite?

2) Where was the COM component created?

Bob
Avatar of collages

ASKER

I am running VB 2005 express.

The COM component is part of Business Objects 6.1.  I am trying to automate running reports.  The COM is the busobj import in the code I posted.  It is called "BusinessObjects 6.0 Object Library".
You should be able to add a reference to a COM through the 'Add Reference' dialog box.  .NET will create the wrapper class for you automatically (Interop.dll).

Bob
Ok...maybe I have another problem then.  I added the reference and have the following code right now:

Imports System
Imports busobj
Imports System.Runtime.InteropServices

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim BusObjApp As New busobj.Application
        Dim BusObjRep As New busobj.Report

But when I try to create the new report I get the COMException.  

Is there something wrong with my code, or does this look like another problem?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How do I check to make sure the COM library is installed?  I think it is becaise I can run the application (Business Objects) just fine.

There is a convoluted way, by looking through the registry under HKEY_CLASSES_ROOT\CLSID for the {2AE0D397-5F2A-11D0-8B75-0000C0FDEBE3} GUID.

Bob
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, I think this might be my own noobness (is that word?) at work here.

Instead of creating a new report I noticed I have the option to create a new document.  Well, I created that and it doing everything I need it to do.

I dont have any documemtation on the business objects library so Im kind of poking in the dark here, but for now I think im cool to move forward.  Thanks for your help guys.