我可以将Visual Basic应用程序链接到C#吗? [英] Can I link a visual basic application to C#?

查看:73
本文介绍了我可以将Visual Basic应用程序链接到C#吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我只是想知道我有一个用C#编写的程序和用Visual Basic编写的其他三个程序。那么我可以单独编译所有程序,在C#中添加它们并链接表格吗?



问候

Aman Chaurasia



我尝试了什么:



我还没试过,因为我想知道是否是否有可能。

Hello,

I just wanted to know that I have a program written in C# and three other programs written in Visual Basic. So can I compile all the programs separately, add them in C# and link the forms?

Regards
Aman Chaurasia

What I have tried:

I have not tried yet because I wanted to know if it is possible or not.

推荐答案

是的,前提是这些应用程序都是为.NET编写的(即VB代码是在V6.0之后)。



.NET应用程序都生成.NET程序集文件,其中包含可以从任何.NET语言访问的中间代码,并使用它们使用相同的语言。

您所要做的就是添加DLL或EXE汇编文件作为C#项目的引用,您将可以访问VB表单,就好像它们是用C#编写的那样。



请注意,并非所有EXE或DLL文件都是.NET程序集:这些扩展也用于其本机代码等价物,根本无法引用,但必须通过DL访问LImport,一种更复杂的方法。
Yes, provided the apps are all written for .NET (i.e. the VB code is after V6.0).

.NET applications all produce .NET Assembly files, which contain intermediate code that can be accessed from any .NET language and used as if it was in the same language.
All you have to do is add the DLL or EXE assembly files as references to your C# project and you will have access to the VB forms as if they were written in C# orginaly.

Do note that not all EXE or DLL files are .NET assemblies: these extensions were also used for their Native code equivalents, which cannot be referenced at all but must be accessed via DLLImport, a much more complex approach.


这篇关于我可以将Visual Basic应用程序链接到C#吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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