开发者

How to use a DLL/TLB from VB6 in VB.Net

开发者 https://www.devze.com 2023-04-04 22:20 出处:网络
I have a DLL and its TLB which works in VB6. I ad开发者_开发百科ded a reference to the DLL and code to use it. The program builds without an error but gives me a runtime error:

I have a DLL and its TLB which works in VB6. I ad开发者_开发百科ded a reference to the DLL and code to use it. The program builds without an error but gives me a runtime error:

The type initializer for "the dll name" threw an exception.

I am guessing I need to register the DLL or something but do not know how to proceed. BTW, both the DLL and TLB are in my project directory.

Any advice is greatly appreciated.

TIA, John


Thanks for your response Hans. I may not have been clear. I am not programming in VB6. I inherited the DLL (and do not have the source code) and the client wants me to use it in my VB.Net application. I do not have a way to debug the DLL unless I can do that in VS2008.

Thanks, John


You're going to need to create an Interop layer between your.Net app and the VB DLL.

Take a look at:

http://msdn.microsoft.com/en-us/library/z6tx9dw3(v=vs.85).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消