本文介绍了在vb6中使用.NET COM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有麻烦使用.NET COM在vb6,它编译确定,我使用regasm注册它,在vb6项目中添加一个引用,它甚至有intellisense。但是当我试图做一个实例,它给我一个自动化错误。任何人都可以帮助?

Im having trouble using a .NET COM in vb6, It compiles ok and I use regasm to register it, add a reference to it in the vb6 project, it even has intellisense. But when I try to make make an instance it gives me an 'Automation Error'. Any one can help?

提前感谢。

推荐答案

可能需要确保您的.NET程序集在VB6应用程序的目录中,或者如果在VB6 IDE中调试它们在VB6.exe的目录中。

You probably need to make sure your .NET assemblies are in the VB6 application's directory, or if debugging in the VB6 IDE that they are in the VB6.exe's directory.

可能使COM interop与.NET程序集更像COM dll(请参阅),但是默认情况下,以通常的方式搜索.NET程序集 - 即在GAC或应用程序目录中 - 即使通过COM interop使用。

It is possible to make COM interop with .NET assemblies work more like COM dlls (see the codebase option of regasm) but by default, .NET assemblies are searched for in the usual way - ie in the GAC or application directory - even when used via COM interop.

通过使用sysinternals 实用程序。

A really simple way to get insight into where your assembly should be is by using sysinternals filemon utility.

这篇关于在vb6中使用.NET COM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 21:58