如何在vs 2012中调用或使用其他项目中的表单到我的主项目? [英] How do I call or use the form from another project to my main project in vs 2012?

查看:106
本文介绍了如何在vs 2012中调用或使用其他项目中的表单到我的主项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题先生,



我创建了2个不同的vs 2012项目,project1和project2。如何从project1调用我想在project2中使用的表单?例如,我想在project2上的project1上使用form1。我应该怎么做才能调用它?或者我使用什么代码?提前谢谢你。

Question sir,

I've created 2 different vs 2012 project, project1 and project2. How can I call the form from project1 that I want to use in project2? For example I want to use the form1 in project1 on a button on project2 .What should I do to call it?or what code do I use? Thank you in advance.

推荐答案

在运行时,没有什么比project更好的了。只有程序集(顺便说一下.NET的一个中心点)和它们的模块。在构建解决方案后,项目被遗忘。



如果您的程序集参与一个应用程序,因此,它们的代码在一个进程中执行,它不会提出任何特殊问题,简化为形式合作的简单(和流行问题):将数据从form1中选定的gridview行传递到form2中的标签或文本框 [ ^ ]。



唯一的事情是:要在程序集之间的边界使用的所有类型和成员都应标记为 public 。在这种情况下,开发与单个整体项目的开发没有什么不同。



-SA
During runtime, there is nothing like "project". There are only assemblies (one of the central points of .NET, by the way) and their modules. "Project" are left behind after you build you solutions.

If your assemblies participate in one application and, hence, their code is executed in one process, it does not present any special problem, which is reduced to a simple (and popular problem) of form collaboration: Pass data from a selected gridview row in form1 to a label or textbox in form2[^].

The only things is: all types and members you want to use across the boundary between assemblies, should be marked as public. In this case, development is no different from the development of a single monolithic project.

—SA


这篇关于如何在vs 2012中调用或使用其他项目中的表单到我的主项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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