Solved

Help with type library .tlb file

Posted on 2011-02-19
3
550 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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