[英]C# and VB in C#
I have ac# and vb .net solution. 我有ac#和vb .net解决方案。 I need to use the c# form inside vb form as a tab. 我需要在vb表单中使用c#表单作为选项卡。 How can I do this? 我怎样才能做到这一点?
You could create one of the forms in a separate class library or as a user control in a separate class library and just reference it from within your application. 您可以在单独的类库中创建其中一个表单,也可以在单独的类库中创建用户控件,只需在应用程序中引用它即可。 Each project in your solution can be either VB.Net or C#, so it works both ways... 您的解决方案中的每个项目可以是VB.Net或C#,因此它可以双向工作......
In a simple example solution you could have the following projects 在一个简单的示例解决方案中,您可以拥有以下项目
Edit 编辑
I'm presuming winforms?? 我假设winforms?
You would need to have Visual Studio Professional to do something like this. 您需要让Visual Studio Professional执行此类操作。
Instead I suggest you use this site to convert your C#.net to VB.net http://www.developerfusion.com/tools/convert/csharp-to-vb/ 相反,我建议您使用此站点将您的C#.net转换为VB.net http://www.developerfusion.com/tools/convert/csharp-to-vb/
No, you can't. 不,你不能。
I suggest to encapsulte the the c#-Form into a separate assembly. 我建议将c#-Form封装到一个单独的程序集中。 Create a UserControl to use it inside the other application or if you need the complete form, encapsulte it into a DLL and export a Show/ShowDialog() method. 创建一个UserControl以在其他应用程序中使用它,或者如果您需要完整的表单,请将其封装到DLL中并导出Show / ShowDialog()方法。
我是通过在C#项目中添加VB项目的.exe文件作为参考并调用VB项目的Form.Show()来实现的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.