c# 类的属性在 Visual Basic 6.0 中不可见 [英] properties of c# class is not visible at visual basic 6.0

查看:23
本文介绍了c# 类的属性在 Visual Basic 6.0 中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 c# 中创建了一个类,并使 com 可见属性为 true.但是,我在 Visual Basic 6.0 中看不到它的属性.可能是什么问题?请帮帮我

I have created a class in c# and made the com visible property is true. But, i could not see the its properties at visual basic 6.0. what could be a problem? please help me

推荐答案

定义一个也是 ComVisible 的公共接口,并让你的类实现它.

Define a public interface that is also ComVisible, and have your class implement that.

然后使用 tlbexp.exe 从您的 C# 程序集生成类型库:

Then use tlbexp.exe to generate a type libary from your C# assembly:

tlbexp ComServer.dll /out:ComServer.tlb

您需要从 VB6 添加对类型库的引用,而不是程序集.那么VB6如何知道你的程序集实际在哪里呢?Regasm 是怎么回事.它相当于 .net 程序集的 regsvr32.

You need to add a reference to the type library from VB6, not the assembly. How does VB6 know where your assembly actually is then? Regasm is how. It is the equivalent of regsvr32 for .net assemblies.

regasm ComServer.dll

这篇关于c# 类的属性在 Visual Basic 6.0 中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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