Solved

Using a VB6 DLL w/o a tlb file in a .NET application

Posted on 2008-06-10
5
1,011 Views
Last Modified: 2013-12-17
I am working with a piece of equipment from a third-party vendor that came with a DLL and a sample VB6 application.  I need to use the supplied DLL in a .NET app written in C#.  I tried to add the DLL as a reference but got an error telling me to make sure the DLL was a valid assembly or COM component.  The vendor supplied the DLL and a .lib file but no .tlb file.  How can I access the DLL from my C# application?

Thanks in advance!
0
Comment
Question by:pdarata
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:appari
ID: 21756794
is the dll registered on the system you are trying to add the reference?
check if you are able to use the dll file from vb application?
if it is not registered try running the followig command and try to add the reference again.

regsvr32 yourdllpath

0
 

Author Comment

by:pdarata
ID: 21756859
I should have mentioned before that when I run regsvr32 I get the error "LoadLibrary...failed. - The specified procedure could not be found."

Unfortunately, I no longer have a Visual Studio 6 environment set up to test with.  I could supply the dll if that would be helpful.
0
 
LVL 39

Expert Comment

by:appari
ID: 21757274
may be the dll is not activex dll.
is the sample vb6 application provided with the dll is big? can you open each of the form or bas modules in some
text editor and see if there are any declare statements referencing the dll file. just search for the dllfilename.dll if you find any declares post them here
0
 
LVL 7

Accepted Solution

by:
Dauhee earned 500 total points
ID: 21758184
the dll may be corrupt. Might be worth getting it sent from the vendor again.

also you can use a depends.exe tool (available from microsoft) to look inside the dll to see what dependancies it has - just in case you need something else installed on your system before you can register the dll.

If the DLL is from VB then it will be COM compaitible and available to .NET via interop. It would be a good idea to get a copy of Visual studio 6 to try compile the dll yourself.
0
 

Author Comment

by:pdarata
ID: 21847156
Apparently the vendor sent a debug version of their dll and I did not have the correct version of the runtime dll to support it.  Once I installed the right version of MSVCRTD.dll I was able to access the vendor's DLL.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

759 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

19 Experts available now in Live!

Get 1:1 Help Now