Solved

Help with type library .tlb file

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multiple file Upload asp.net 2 36
VB.Net - Oracle BulkCopy from CSV Date Format 7 44
DataGridView Events ? 3 37
scanning dentists xray (the small ones) 3 41
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

21 Experts available now in Live!

Get 1:1 Help Now