Solved

Help with type library .tlb file

Posted on 2011-02-19
3
545 Views
Last Modified: 2012-05-11
Hi,

I was wondering if someone can help. I have created a class library and have generated and registered a type library (.tlb) file and have successfully managed add this in a project that I need to use this file.
The only problem is when I make the call to the class within this file it’s now looking for files that I have referenced within that library. I have tried copying all the files from my release folder to the location where I have the application without any success.
Any help would be appreciated.

Regards,

Ross
0
Comment
Question by:ross13
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 34939186
Ross,

I am confused what you are really working with, and I need to ask some preliminary questions:

1) .NET version?

2) Are you trying to create a .NET assembly that is accessible in COM?
0
 

Author Comment

by:ross13
ID: 34939360
Hi,

I initially created a library file (.dll) using visual studio 2008 (.NET 3.5) and was trying to reference this using a Microsoft access application (version 2003) that someone else has developed.

I asked another question the other day that allowed me to add this reference this via the access application by creating a .TBL file:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26831994.html
I then tried to call a class within this and the access application gave the following message:
"could not load file or assembly or one of its dependencies. The system can not find the specified file”

The message gave the name of a file that I reference in the visual studio application that I compiled as a .TBL file.

Cheers,

Ross
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 34939400
Have you read anything like this?

Calling a .NET Component from a COM Component
http://msdn.microsoft.com/en-us/library/ms973802.aspx

There are two prerequisites to keep in mind when creating a .NET class that will be used by COM clients.

First, explicitly define an interface in your Visual Basic .NET code, and have the class implement the interface.


Secondly, any class that is to be visible to COM clients must be declared public. The tools that create the CCW only define types based on public classes. The same rule applies to methods, properties, and events that will be used by COM clients.


Register the Assembly and Create a Type Library
At this point, you could use the new assembly and the NET_Temperature class from another .NET application. But, you still have to make the class and its members available to your COM applications. Open a Visual Studio .NET command prompt (Click Start, then Programs, then Microsoft Visual Studio .NET 7.0, then Visual Studio .NET Tools, and then Visual Studio .NET Command Prompt), change to the project directory for PhysServer2, and type:

     regasm /tlb:PhysServer2.tlb PhysServer2.dll

The regasm utility will create a type library and register it in your Windows registry to make the classes in PhysServer2.dll available to COM clients.

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now