VB.NET 2008 从另一个项目导入表单?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2036229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 14:35:44  来源:igfitidea点击:

VB.NET 2008 importing forms from another project?

vb.net

提问by Alex

I have some form/vb in another project that I want to import to a new one. There are three files with these extensions - .vb, resx, and designer.vb. Which do I copy and how exactly?

我在另一个项目中有一些表单/vb,我想导入到一个新项目中。共有三个具有这些扩展名的文件 - .vb、resx 和 Designer.vb。我要复制哪些内容以及如何复制?

回答by hawbsl

If you are copying the files outside of Visual Studio (e.g. in Windows Explorer) you need to copy all three.

如果您在 Visual Studio 之外复制文件(例如在 Windows 资源管理器中),您需要复制所有三个文件。

But working in Visual Studio you only need to copy the base .vbfile; the .designer.vband the .resxwill be copied for you automatically. How to do this? Right click on your project file in Solution Explorer and choose Add-> Existing Item.

但是在 Visual Studio 中工作你只需要复制基本的.vb文件;在.designer.vb的.resx将自动为您复制。这该怎么做?在解决方案资源管理器中右键单击您的项目文件,然后选择Add-> Existing Item

回答by Eilon

You need to copy all the files. You should even be able to open two instances of Visual Studio and drag and drop the form from one to the other.

您需要复制所有文件。您甚至应该能够打开 Visual Studio 的两个实例并将表单从一个拖放到另一个实例。

Once you do the copy you'll probably want to change the namespaces and/or type names inside the files because they might be pointing to names from the previous project.

完成复制后,您可能希望更改文件中的命名空间和/或类型名称,因为它们可能指向上一个项目的名称。

回答by John K

You need to copy all files over. If you copy and paste them using the file system, in Visual Studio Solution Explorer they won't appear. You will need to "show all" files. Then everything in the project directory is shown allowing you to right-click them and "include" them in your project.

您需要复制所有文件。如果您使用文件系统复制和粘贴它们,它们将不会出现在 Visual Studio 解决方案资源管理器中。您将需要“显示所有”文件。然后显示项目目录中的所有内容,允许您右键单击它们并将它们“包含”到您的项目中。