将vb.net类库导入到vb6项目 [英] import vb.net class library to vb6 project

查看:157
本文介绍了将vb.net类库导入到vb6项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个vb.net类库。它是存储设备的接口。它提供了一些对象和方法以便将数据读取和写入设备。



问题是客户有一个vb6应用程序,我们要在其中添加以下功能:类库以操纵设备。我将类更改为com类,选中了com interopt复选框,并使用.net framework 2.0 regasm.exe注册了该库。



我添加了该库作为对a的引用空白的vb6项目,并创建了一个对象。 / pre>

当我添加以下对象时,该对象等于无




$ b

  t =新comlib.obj 

  t = createobject( comlib.obj)

我遇到以下错误:


运行时错误' 2147024894(80070002)':自动化


我在做什么错了?

解决方案

仅将变量变暗并不会为其分配值(与.NET private TypeName variableName; 相同),首先使用 Set T = New Comlib.Obj 创建它。



错误,您需要使用标准的调试技术来缩小范围,或者发布完整的错误消息,然后有人可以提供建议。


I have created a vb.net class library. It is an interface for a storage device. It gives some objects and methods in order to read and write data to the device.

The problem is that a customer has a vb6 application where we want to add the functionality of the class library in order to manipulate the device. i have changed the classes to com classes, checked the com interopt checkbox and registered the library with .net framework 2.0 regasm.exe.

I added the library as reference to a blank vb6 project and created an object.

dim t as comlib.obj

the object was equal to 'nothing'

when I added:

t = new comlib.obj

or

 t = createobject("comlib.obj")

I got the following error:

run-time error '2147024894 (80070002)': Automation

what am I doing wrong?

解决方案

Just dimming a variable doesn't assign it a value (the same as a .NET private TypeName variableName;), you need to create it first using Set T = New Comlib.Obj.

If you get an error from this, you need to use standard debugging techniques to narrow it down, or maybe post your full error message and someone can advise.

这篇关于将vb.net类库导入到vb6项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆