使用vb控件 [英] using vb control

查看:58
本文介绍了使用vb控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小小的vb控件,我想在我的c#

应用程序中使用。我不想做一个独立的.dll,因为

它太小了。任何人都可以告诉我如何将它包含在我的视觉工作室

..net项目并将其正确编译为VB?

I have been given a tiny little vb control that I would like to use in my c#
application. I don''t want to make an independant .dll out of it because
it''s so small. Can anyone tell me how I can include it in my visual studio
..net project and have it properly compiled as VB ?

推荐答案

嗨Mike,


根据我的理解,你想在.Net项目中使用你的VB控件。


我想你的Vb控件是一个Active X控件,它也是一个COM

组件。在.Net中,您可以通过COM互操作使用COM。


在VS.net中,您只需使用添加引用即可。浏览到VB控件和

将其添加到。然后VS.net会自动为你的COM组件添加一个.Net类包装器




然后你可以像.Net类一样使用它。有关您的包装VB控件的更多详细信息和类

信息,您可以在

对象浏览器中看到它的参考


==================================

请在上面提出我的建议让我知道它是否有助于解决您的问题。


感谢您的耐心和合作。如果您有任何疑问或

担忧,请随时将其发布在小组中。我正准备等待

的帮助。


祝你好运,

Jeffrey Tan

Microsoft在线合作伙伴支持

安全! - www.microsoft.com/security

此帖子按原样提供没有保证,也没有赋予任何权利。

Hi Mike,

Based on my understanding, you want to use your VB control in .Net project.

I think your Vb control is an Active X control, which is also a COM
component. In .Net, you can use COM through COM interop.

In VS.net, you can just use "Add Reference" to browse to the VB control and
add it into. Then VS.net will automatically add a .Net class wrapper for
your COM component.

Then you can use it like .Net class. For more detail information and class
information about your wrapped VB control, you can see its reference in
"Object Browser"

==================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


我想我没有很好地描述我的问题。我有两个

文件,一个是实现用户控制的.vb文件,用
VB.NET编写,另一个是补充.resx文件。我想将
编译成我的c#项目,但在该项目中编译器

似乎无法识别VB。如何成功地将这些文件添加到我的c#项目中,并让编译器知道该怎么做。我宁愿

赞成它不是完全自动的。

"" Jeffrey Tan [MSFT]"" <,V - ***** @ online.microsoft.com>在消息中写道

新闻:哟************* @ cpmsftngxa10.phx.gbl ...
I guess I didn''t describe my problem very well. I have been given two
files, one that is is a .vb file which implements user control, written in
VB.NET and the other is the complementory .resx file. I would like to
compile these into my c# project, but within that project the compiler
doesn''t seem to recognize VB. How can I successfully add these files into
my otherwise c# project and get the compiler to know what to do. I''m rather
suprized it''s not completely automatic.
""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:Yo*************@cpmsftngxa10.phx.gbl...
嗨Mike,
根据我的理解,你想在.Net
项目中使用VB控件。
我认为你的Vb控件是一个Active X控件,也是一个COM
零件。在.Net中,您可以通过COM互操作使用COM。

在VS.net中,您只需使用添加引用即可。浏览VB控件
并将其添加到。然后VS.net会自动为你的COM组件添加一个.Net类包装器。

然后你可以像.Net类一样使用它。有关包装的VB控件的更多详细信息和类
信息,您可以在
对象浏览器中看到它的参考。

========== ========================
请在上面提出我的建议并告诉我它是否有助于解决您的问题。 />
感谢您的耐心与合作。如果您有任何疑问或担忧,请随时在小组中发布。我很乐意帮助您。

致以最诚挚的问候,
Jeffrey Tan
Microsoft在线合作伙伴支持
获得安全保障! - www.microsoft.com/security
此帖子提供就像没有保证,也没有授予任何权利。
Hi Mike,

Based on my understanding, you want to use your VB control in .Net project.
I think your Vb control is an Active X control, which is also a COM
component. In .Net, you can use COM through COM interop.

In VS.net, you can just use "Add Reference" to browse to the VB control and add it into. Then VS.net will automatically add a .Net class wrapper for
your COM component.

Then you can use it like .Net class. For more detail information and class
information about your wrapped VB control, you can see its reference in
"Object Browser"

==================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



您好Mike,


非常感谢您的反馈。


哦,根据你的反馈,我看到你所拥有的是一个VB.net

usercontrol'的源文件。你想在C#项目中使用它。


对于一个C#项目,它将使用csc.exe编译器来编译它并生成

程序集。它无法识别VB.net代码。


你应该在你的整个

解决方案中添加一个新的VB.net windows控件项目,然后添加VB。 net usercontrol源代码进入这个项目。

然后,你可以编译这个项目,一个程序集将为这个

VB.net用户控件源代码生成。


最后,您可以通过Add

参考或通过工具箱将此usercontrol程序集添加到C#项目中


==== ===============================

请在上面提出我的建议,如果有的话请告诉我有助于解决你的问题。


感谢您的耐心和合作。如果您有任何疑问或

担忧,请随时将其发布在小组中。我正准备等待

的帮助。


祝你好运,

Jeffrey Tan

Microsoft在线合作伙伴支持

安全! - www.microsoft.com/security

此帖子按原样提供没有保证,也没有赋予任何权利。

Hi Mike,

Thanks very much for your feedback.

Oh, based on your feedback, I see that what you have is a VB.net
usercontrol''s source file. You want to use it in a C# project.

For a C# project, it will use csc.exe compiler to compile it and generate
assembly. It can not recognize VB.net code.

You should add a new VB.net windows control project into your entire
Solution, then add the VB.net usercontrol source code into this project.
Then, you can compile this project, an assembly will generate for this
VB.net usercontrol source code.

At last, you may add this usercontrol assembly into C# project through Add
Reference or through Tool Box

===================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


这篇关于使用vb控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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