用于VB的C#包装器或C#和VB项目之间的交互性 [英] C# wrapper for VB or interactivity between C# and VB projects

查看:59
本文介绍了用于VB的C#包装器或C#和VB项目之间的交互性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在编写一个C#代码,该代码应该能够在Visual Basic中已经编写的代码中利用某些功能. VB项目具有自己的GUI.我的C#GUI应该包括VB项目具有的应用程序的所有输入,并且还应重复调用某些方法. VB项目将结果日期写入单独的纯文本文件中.这些数据需要附加到单个文件中,并根据时间进行排序.
解决此问题的最佳方法是什么?有什么办法在C#中为vb编写包装器吗?如果是,该如何处理?我在C#和C ++之间的另一个问题中看到了类似的问题.提到过通过C#调用vb方法吗?用C#和VB怎么可能?请提供尽可能多的细节,因为编码是我刚刚开始做的事情,我真的很喜欢.
这个网站及其成员对我的学习过程提供了极大的帮助.谢谢大家...:)

Hello Everyone

I am writing a C# code that should be able to utilize certain functionalities in an already written code in visual basic. The VB project has its own GUI. My C# GUI should include all inputs to the application that the VB project has and also invoke some of the methods repeatedly. the VB project writes the outcome date into individual flat text files. These data need to be appended into a single file and sorted based on time.
What is the best way to approach this problem. Is there any way to write a wrapper for the vb in C#? if yes, how to approach it? I saw a similar issue in another question between C# and C++. There was a mention of invoking the vb methods through C#? how is this possible with C# and VB? Please provide as much detail as you can since coding is something that I just started doing, which I''m really liking.
This site and it''s members have been an extremely big help in my learning process. THANK YOU ALL... :)

推荐答案

如果它们都是.NET,那么您要做的就是在C#项目中添加对VB项目的引用. .您也可以选择添加usi9ng语句来访问名称空间.就.NET而言,代码是VB还是C#都没关系-可以直接访问.您可能会发现的唯一区别是VB不区分大小写,而C#则不区分大小写.

如果VB为VB6或更小,它将变得更加复杂.
If they are both .NET, then all you need to do is add a reference to the VB project in your C# project. Optionally, you can also add a usi9ng statement to access the namespace. As far as .NET is concerned, it doesn''t matter if the code was VB or C# - it can just be accessed. The only difference you may find is that VB is no case sensitive, C# is.

If the VB is VB6 or less, then it gets more complicated.


感谢您的回答.当您提到添加对VB的引用时,请更具体一点.我怎么做?请提供一个快速的示例.
谢谢
Thanks for the answer. Would you please be a little more specific when you mention adding a reference to VB. How do I do that? please provide a quick and sample.
Thanks


这篇关于用于VB的C#包装器或C#和VB项目之间的交互性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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